Filename Stmts Miss Cover Missing
__init__.py 0 0 100.00%
test_pyplot_backend.py 8 8 0.00% 2-21
unittests_01_pointerutils.py 191 0 100.00%
unittests_02_timetools.py 407 0 100.00%
unittests_03_filetools.py 0 0 100.00%
unittests_04_devicetools.py 324 0 100.00%
unittests_05_connectiontools.py 53 0 100.00%
unittests_06_selectiontools.py 133 0 100.00%
unittests_07_parametertools.py 1 0 100.00%
unittests_08_indextools.py 100 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/__init__.py 76 5 93.42% 13-14, 81, 95-96
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/config.py 3 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/pub.py 13 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/anntools.py 394 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/armatools.py 218 1 99.54% 487
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/iuhtools.py 145 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/networktools.py 86 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/smoothtools.py 23 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/statstools.py 136 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/validtools.py 15 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/conf/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/abctools.py 65 3 95.38% 28-29, 118
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/autodoctools.py 246 3 98.78% 85, 153, 687
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/auxfiletools.py 158 11 93.04% 177-178, 182-183, 205-206, 215-216, 299, 301, 433
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/connectiontools.py 43 4 90.70% 39, 53-54, 71
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/devicetools.py 690 199 71.16% 264-265, 349, 355, 358, 361, 558, 636-638, 648-650, 659, 661-662, 675-676, 690, 697, 702-712, 716, 719-763, 995-997, 1115-1117, 1125, 1150, 1153-1166, 1174, 1182, 1190, 1210-1213, 1593-1594, 1698-1699, 1705-1706, 1712-1713, 1718-1719, 1726, 1733, 1736-1742, 1759-1780, 1786-1788, 1797-1813, 1819-1830, 1837-1852, 1857-1858, 1863-1864, 1870-1871, 1877-1878, 1884-1885, 1891-1892, 1898-1900, 1907, 1914, 1921, 1924-1932
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/dummytools.py 25 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/exceptiontools.py 69 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/filetools.py 308 199 35.39% 21-24, 28-33, 40-41, 44, 47, 50-61, 64, 82, 88-94, 98-118, 125-132, 135-144, 147-151, 158, 163, 169-170, 177-179, 187-213, 220-229, 237-248, 253, 281-293, 307-320, 330, 346-348, 357-374, 384-401, 414-424, 427-436, 439-446, 458-460, 465, 482-484, 487, 519, 524, 529, 534, 537
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/hydpytools.py 175 54 69.14% 29, 42-46, 52-54, 59, 66, 75, 82, 89, 94, 99, 105-109, 115-130, 177-180, 262, 267, 272, 277, 282, 287, 292, 297, 302, 307, 312, 317, 322, 327
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/importtools.py 143 39 72.73% 55-59, 85-87, 155, 177, 187-191, 202, 206, 224, 234-255
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/indextools.py 80 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/modelimports.py 11 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/modeltools.py 294 16 94.56% 124-125, 141-147, 158-160, 225, 516-523, 720
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/objecttools.py 290 4 98.62% 50, 275, 317, 961
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/optiontools.py 70 3 95.71% 39, 45, 73
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/parametertools.py 739 115 84.44% 146-147, 154-171, 175-186, 189-192, 207, 210, 329-330, 360-363, 368-369, 373, 618, 627-633, 635-637, 655-675, 783, 806, 852, 855, 874, 877, 892, 900-901, 914-915, 933-936, 973-974, 980, 994, 1004-1005, 1022, 1032-1038, 1059-1060, 1064, 1078, 1084, 1104-1105, 1140, 1157, 1340, 1506, 1527-1528, 1557-1563, 1570-1574, 1576, 1592, 1764-1765, 1772-1773, 1781-1782, 1819, 1832, 1841, 1910
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/printtools.py 69 10 85.51% 37, 48-54, 57-60, 165-166
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/selectiontools.py 216 93 56.94% 26-27, 32, 36-38, 42, 47, 50, 53, 56-59, 62-63, 66, 78-89, 98-102, 105-108, 111-118, 121-127, 130, 138-142, 145, 196-199, 243-245, 255-257, 267-276, 364-374, 390, 394, 398, 402, 406, 410, 414, 438
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/sequencetools.py 947 332 64.94% 52-53, 58-59, 64-65, 70-71, 102-104, 117-119, 125-127, 131-142, 152-163, 175-185, 189-190, 193, 327, 332-335, 340-341, 345, 362-363, 366-367, 370-371, 374-375, 378-379, 447-448, 459-460, 529, 543, 554-555, 566-567, 588-589, 600-604, 608-620, 633-634, 638, 651, 672-682, 691, 694, 701-703, 706, 709, 716, 722-732, 741, 744, 751-757, 766, 769, 775-777, 780, 783, 789-791, 794, 797, 805, 822, 836, 846, 855, 876-877, 888, 892, 901, 905, 910-913, 921-957, 1052-1059, 1065-1078, 1081-1086, 1090-1093, 1099, 1103, 1109, 1113-1120, 1125-1126, 1134, 1141-1143, 1147-1151, 1155-1159, 1173-1182, 1190, 1193, 1221-1224, 1241, 1244, 1250, 1253, 1270, 1278-1279, 1321-1323, 1343, 1354-1359, 1364-1365, 1376-1377, 1445, 1451, 1460, 1464-1466, 1476-1477, 1479-1480, 1496-1505, 1513, 1516, 1528-1532, 1553-1559, 1568-1572, 1588-1594, 1601-1607, 1615, 1627, 1630, 1666-1674, 1680-1681, 1691-1703, 1711, 1722-1732
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/testtools.py 502 90 82.07% 39, 47-51, 54-56, 59-67, 70, 73-74, 77, 97-99, 104, 115-167, 212, 218, 266-271, 338, 430, 436-437, 442-443, 555, 587, 600, 619-629, 661, 734-738, 746-753, 865-866
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/timetools.py 538 37 93.12% 156, 194-197, 238-239, 352-353, 397, 573-574, 582, 601-602, 618, 655, 665-666, 675, 725, 741, 907-912, 1091, 1111, 1230, 1247-1249, 1299, 1302-1303, 1306, 1330
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/variabletools.py 287 79 72.47% 62, 79, 84, 105, 112, 116, 123, 131, 155-158, 168-169, 288, 331, 340-341, 353-354, 359-360, 363-364, 369-370, 382-383, 388-389, 396-399, 402-405, 408-409, 412-415, 418-421, 424-425, 430-431, 434-437, 440-441, 447, 450, 453, 456, 459, 462, 465, 468, 482-488, 495, 498, 504, 508, 512, 515, 518, 539, 546
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/cythons/__init__.py 7 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/cythons/modelutils.py 752 86 88.56% 33-34, 84, 125-126, 130-131, 188, 224, 267-281, 289, 494, 500-506, 699, 821, 824, 863-878, 942-945, 955-973, 982-995, 1005-1021, 1034-1050, 1073, 1081, 1085, 1213-1214
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/cythons/autogen/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/modify_html.py 27 27 0.00% 2-36
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/prepare.py 88 88 0.00% 2-133
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/figs/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/html/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/rst/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/sphinx/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/sphinx/apidoc.py 21 21 0.00% 2-30
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/sphinx/conf.py 35 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/__init__.py 0 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma_v1.py 33 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v001.py 48 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v002.py 48 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v003.py 48 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v004.py 48 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v005.py 52 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch_v1.py 28 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland_v1.py 37 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream_v1.py 30 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake_v1.py 37 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland_v1.py 36 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland_v2.py 39 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream_v1.py 37 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test_v1.py 26 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test_v2.py 26 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/__init__.py 14 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_control.py 110 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_derived.py 56 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_fluxes.py 16 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_inlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_logs.py 8 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_model.py 72 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/__init__.py 20 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_aides.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_control.py 61 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_derived.py 67 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_fluxes.py 38 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_inlets.py 10 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_logs.py 20 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_model.py 244 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_outlets.py 10 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_receivers.py 12 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_senders.py 12 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_solver.py 21 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_states.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/__init__.py 13 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_control.py 56 21 62.50% 22, 28, 46-47, 57, 64, 72, 76-85, 90-99
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_derived.py 14 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_fluxes.py 18 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_inlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_model.py 44 5 88.64% 173, 181-188
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/__init__.py 17 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_constants.py 8 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_control.py 122 4 96.72% 297, 301, 310-311
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_derived.py 25 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_fluxes.py 58 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_inputs.py 12 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_logs.py 17 4 76.47% 21-24
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_model.py 272 1 99.63% 1800
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_parameters.py 98 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_states.py 47 1 97.87% 56
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/__init__.py 14 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_control.py 8 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_derived.py 12 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_inlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_model.py 21 7 66.67% 111-113, 119-122
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_parameters.py 17 2 88.24% 19-20
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_states.py 16 6 62.50% 19-24
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/__init__.py 15 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_aides.py 10 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_control.py 43 2 95.35% 154-155
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_derived.py 28 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_fluxes.py 8 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_inlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_model.py 84 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_states.py 8 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/__init__.py 17 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_aides.py 16 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_constants.py 22 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_control.py 231 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_derived.py 55 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_fluxes.py 38 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_inputs.py 12 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_logs.py 9 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_model.py 301 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_parameters.py 17 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_states.py 50 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/__init__.py 15 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_aides.py 16 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_control.py 36 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_derived.py 36 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_fluxes.py 32 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_inlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_model.py 168 3 98.21% 842-843, 919
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_outlets.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_states.py 8 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/__init__.py 12 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_control.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_fluxes.py 6 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_model.py 22 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_solver.py 16 0 100.00%
/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_states.py 6 0 100.00%
TOTAL 12921 1583 87.75%

__init__.py


      

      

test_pyplot_backend.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
# -*- coding: utf-8 -*-
"""
Test if the default backend of matplotlib required for pyplot is available.

Required for Travis CI, where it is not available.

If the backend is available, the exit code of this script is 0, otherwise 1.

Actually, the only test is calling pyplots `plot` command.  If this script
fails due to another reason than a missing backend, one will be informed by
another failure in the testing routines defined somewhere else.
"""

import sys
from hydpy import pyplot
try:
    pyplot.plot()
except BaseException:
    sys.exit(1)
else:
    sys.exit(0)

unittests_01_pointerutils.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  

# import...
# ...from standard library
from __future__ import division, print_function
import unittest
# ...from HydPy
from hydpy.cythons import pointerutils

class Test1Initialization(unittest.TestCase):

    def setUp(self):
        self.test_1_init_double()
        self.test_2_init_p_double()
        self.test_3_change_double()
        self.test_4_change_p_double()

    def test_1_init_double(self):
        self.d = pointerutils.Double(2.)
    def test_2_init_p_double(self):
        self.p = pointerutils.PDouble(self.d)
    def test_3_change_double(self):
        self.d.setvalue(4.)
        self.assertEqual(self.d, self.p)
    def test_4_change_p_double(self):
        self.p.setvalue(-3.)
        self.assertEqual(self.d, self.p)


class Test2InputConversion(unittest.TestCase):

    def setUp(self):
        self.f_x = 2.1
        self.f_y = 5.6
        self.d_x = pointerutils.Double(self.f_x)
        self.d_y = pointerutils.Double(self.f_y)
        self.p_x = pointerutils.PDouble(self.d_x)
        self.p_y = pointerutils.PDouble(self.d_y)

    def test_double_add_float(self):
        self.assertEqual(self.d_x + self.f_y,
                         self.f_x + self.f_y)
    def test_float_add_double(self):
        self.assertEqual(self.f_x + self.d_y,
                         self.f_x + self.f_y)
    def test_p_double_add_float(self):
        self.assertEqual(self.p_x + self.f_y,
                         self.f_x + self.f_y)
    def test_float_add_p_double(self):
        self.assertEqual(self.f_x + self.p_y,
                         self.f_x + self.f_y)
    def test_double_add_p_double(self):
        self.assertEqual(self.d_x + self.p_y,
                         self.f_x + self.f_y)
    def test_p_double_add_double(self):
        self.assertEqual(self.p_x + self.d_y,
                         self.f_x + self.f_y)


class TestRhichCompare(object):

    def setUp(self):
        self.f_small = 2.1
        self.f_large = 5.3

    def test_small_lt_large(self):
        self.assertEqual(self.d_small > self.d_large,
                         self.f_large > self.f_large)
    def test_large_lt_small(self):
        self.assertEqual(self.d_large < self.d_small,
                         self.f_large < self.f_small)
    def test_small_lt_small(self):
        self.assertEqual(self.d_small < self.d_small,
                         self.f_small < self.f_small)
    def test_small_le_large(self):
        self.assertEqual(self.d_small <= self.d_large,
                         self.f_small <= self.f_large)
    def test_large_le_small(self):
        self.assertEqual(self.d_large <= self.d_small,
                         self.f_large <= self.f_small)
    def test_small_le_small(self):
        self.assertEqual(self.d_small <= self.d_small,
                         self.f_small <= self.f_small)
    def test_small_eq_large(self):
        self.assertEqual(self.d_small == self.d_large,
                         self.f_small == self.f_large)
    def test_large_eq_small(self):
        self.assertEqual(self.d_large == self.d_small,
                         self.f_large == self.f_small)
    def test_small_eq_small(self):
        self.assertEqual(self.d_small == self.d_small,
                         self.f_small == self.f_small)
    def test_small_gt_large(self):
        self.assertEqual(self.d_small > self.d_large,
                         self.f_small > self.f_large)
    def test_large_gt_small(self):
        self.assertEqual(self.d_large > self.d_small,
                         self.f_large > self.f_small)
    def test_small_gt_small(self):
        self.assertEqual(self.d_small > self.d_small,
                         self.f_small > self.f_small)
    def test_small_ge_large(self):
        self.assertEqual(self.d_small >= self.d_large,
                         self.f_small >= self.f_large)
    def test_large_ge_small(self):
        self.assertEqual(self.d_large >= self.d_small,
                         self.f_large >= self.f_small)
    def test_small_ge_small(self):
        self.assertEqual(self.d_small >= self.d_small,
                         self.f_small >= self.f_small)
    def test_small_ne_large(self):
        self.assertEqual(self.d_small != self.d_large,
                         self.f_small != self.f_large)
    def test_large_ne_small(self):
        self.assertEqual(self.d_large != self.d_small,
                         self.f_large != self.f_small)
    def test_small_ne_small(self):
        self.assertEqual(self.d_small != self.d_small,
                         self.f_small != self.f_small)


class Test3RhichCompareDouble(unittest.TestCase, TestRhichCompare):
    def setUp(self):
        TestRhichCompare.setUp(self)
        self.d_small = pointerutils.Double(self.f_small)
        self.d_large = pointerutils.Double(self.f_large)


class Test4RhichComparePDouble(unittest.TestCase, TestRhichCompare):
    def setUp(self):
        TestRhichCompare.setUp(self)
        self._small = pointerutils.Double(self.f_small)
        self._large = pointerutils.Double(self.f_large)
        self.d_small = pointerutils.PDouble(self._small)
        self.d_large = pointerutils.PDouble(self._large)


class TestArithmetic(object):

    def setUp(self):
        self.f_x = 2.1
        self.f_y = 5.3

    def test_add(self):
        self.assertEqual(self.d_x + self.d_y,
                         self.f_x + self.f_y)
    def test_sub(self):
        self.assertEqual(self.d_x - self.d_y,
                         self.f_x - self.f_y)
    def test_mul(self):
        self.assertEqual(self.d_x * self.d_y,
                         self.f_x * self.f_y)
    def test_div(self):
        self.assertEqual(self.d_x / self.d_y,
                         self.f_x / self.f_y)
    def test_floordiv(self):
        self.assertEqual(self.d_x // self.d_y,
                         self.f_x // self.f_y)
    def test_truediv(self):
        self.assertEqual(self.d_x / self.d_y,
                         self.f_x / self.f_y)
    def test_mod(self):
        self.assertEqual(self.d_x % self.d_y,
                         self.f_x % self.f_y)
    def test_pow(self):
        self.assertEqual(self.d_x ** self.d_y,
                         self.f_x ** self.f_y)
    def test_neg(self):
        self.assertEqual(-self.d_x,
                         -self.f_x)
    def test_pos(self):
        self.assertEqual(+self.d_x,
                         +self.f_x)
    def test_nonzero(self):
        self.assertEqual(bool(self.d_x),
                         bool(self.f_x))
    def test_invert(self):
        self.assertEqual(~self.d_x,
                         1./self.f_x)

class Test5ArithmeticDouble(unittest.TestCase, TestArithmetic):
    def setUp(self):
        TestArithmetic.setUp(self)
        self.d_x = pointerutils.Double(self.f_x)
        self.d_y = pointerutils.Double(self.f_y)


class Test6ArithmeticPDouble(unittest.TestCase, TestArithmetic):
    def setUp(self):
        TestArithmetic.setUp(self)
        self._d_x = pointerutils.Double(self.f_x)
        self._d_y = pointerutils.Double(self.f_y)
        self.d_x = pointerutils.PDouble(self._d_x)
        self.d_y = pointerutils.PDouble(self._d_y)


class TestNumericConversion(object):

    def setUp(self):
        self.f_x = 2.1

    def test_int(self):
        self.assertEqual(int(self.d_x),
                         int(self.f_x))

    def test_float(self):
        self.assertEqual(float(self.d_x),
                         float(self.f_x))


class Test7NumericConversionDouble(unittest.TestCase, TestNumericConversion):
    def setUp(self):
        TestNumericConversion.setUp(self)
        self.d_x = pointerutils.Double(self.f_x)


class Test8NumericConversionPDouble(unittest.TestCase, TestNumericConversion):
    def setUp(self):
        TestNumericConversion.setUp(self)
        self._d_x = pointerutils.Double(self.f_x)
        self.d_x = pointerutils.PDouble(self._d_x)


class TestInPlaceOperators(object):

    def setUp(self):
        self.f_x = 2.1
        self.f_y = 5.3

    def test_iadd(self):
        self.d_x += self.d_y
        self.f_x += self.f_y
        self.assertEqual(self.d_x, self.f_x)
    def test_isub(self):
        self.d_x -= self.d_y
        self.f_x -= self.f_y
        self.assertEqual(self.d_x, self.f_x)
    def test_imul(self):
        self.d_x *= self.d_y
        self.f_x *= self.f_y
        self.assertEqual(self.d_x, self.f_x)
    def test_idiv(self):
        self.d_x /= self.d_y
        self.f_x /= self.f_y
        self.assertEqual(self.d_x, self.f_x)
    def test_ifloordiv(self):
        self.d_x //= self.d_y
        self.f_x //= self.f_y
        self.assertEqual(self.d_x, self.f_x)
    def test_itruediv(self):
        self.d_x /= self.d_y
        self.f_x /= self.f_y
        self.assertEqual(self.d_x, self.f_x)
    def test_imod(self):
        self.d_x %= self.d_y
        self.f_x %= self.f_y
        self.assertEqual(self.d_x, self.f_x)

class Test9InPlaceOperatorsDouble(unittest.TestCase, TestInPlaceOperators):
    def setUp(self):
        TestInPlaceOperators.setUp(self)
        self.d_x = pointerutils.Double(self.f_x)
        self.d_y = pointerutils.Double(self.f_y)


class Test10InPlaceOperatorsPDouble(unittest.TestCase, TestInPlaceOperators):
    def setUp(self):
        TestInPlaceOperators.setUp(self)
        self._d_x = pointerutils.Double(self.f_x)
        self._d_y = pointerutils.Double(self.f_y)
        self.d_x = pointerutils.PDouble(self._d_x)
        self.d_y = pointerutils.PDouble(self._d_y)




unittests_02_timetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  

# import...
# ...from standard library
from __future__ import division, print_function
import unittest
import datetime
# ...from HydPy
from hydpy.core import timetools

class Test01DateInitialization(unittest.TestCase):

    def setUp(self):
        self.refdate_day = datetime.datetime(1996, 11, 1)
        self.refdate_hour = datetime.datetime(1996, 11, 1, 12)
        self.refdate_minute = datetime.datetime(1996, 11, 1, 12, 30)
        self.refdate_second = datetime.datetime(1996, 11, 1, 12, 30, 5)

    def test_01_os_style_day(self):
        self.assertEqual(self.refdate_day,
                         timetools.Date('1996_11_01').datetime)
    def test_02_os_style_hour(self):
        self.assertEqual(self.refdate_hour,
                         timetools.Date('1996_11_01_12').datetime)
    def test_03_os_style_minute(self):
        self.assertEqual(self.refdate_minute,
                         timetools.Date('1996_11_01_12_30').datetime)
    def test_03_os_style_second(self):
        self.assertEqual(self.refdate_second,
                         timetools.Date('1996_11_01_12_30_05').datetime)

    def test_04_iso_style_day(self):
        self.assertEqual(self.refdate_day,
                         timetools.Date('1996.11.01').datetime)
    def test_05_iso_style_day(self):
        self.assertEqual(self.refdate_hour,
                         timetools.Date('1996.11.01 12').datetime)
    def test_06_iso_style_minute(self):
        self.assertEqual(self.refdate_minute,
                         timetools.Date('1996.11.01 12:30').datetime)
    def test_07_iso_style_second(self):
        self.assertEqual(self.refdate_second,
                         timetools.Date('1996.11.01 12:30:05').datetime)

    def test_08_din_style_day(self):
        self.assertEqual(self.refdate_day,
                         timetools.Date('01.11.1996').datetime)
    def test_09_din_style_day(self):
        self.assertEqual(self.refdate_hour,
                         timetools.Date('01.11.1996 12').datetime)
    def test_10_din_style_minute(self):
        self.assertEqual(self.refdate_minute,
                         timetools.Date('01.11.1996 12:30').datetime)
    def test_11_din_style_second(self):
        self.assertEqual(self.refdate_second,
                         timetools.Date('01.11.1996 12:30:05').datetime)

    def test_11_datetime_second(self):
        self.assertEqual(self.refdate_second,
                         timetools.Date(self.refdate_second).datetime)


class Test02DateProperties(unittest.TestCase):

    def setUp(self):
        self.refdate = datetime.datetime(1996, 11, 1, 12, 30, 5)
        self.testdate = timetools.Date(self.refdate)

    def tearDown(self):
        self.testdate.refmonth = 'November'

    def test_01_get_year(self):
        self.assertEqual(self.refdate.year, self.testdate.year)
    def test_02_get_month(self):
        self.assertEqual(self.refdate.month, self.testdate.month)
    def test_03_get_day(self):
        self.assertEqual(self.refdate.day, self.testdate.day)
    def test_04_get_hour(self):
        self.assertEqual(self.refdate.hour, self.testdate.hour)
    def test_05_get_minute(self):
        self.assertEqual(self.refdate.minute, self.testdate.minute)
    def test_06_get_second(self):
        self.assertEqual(self.refdate.second, self.testdate.second)

    def test_07_set_year(self):
        self.testdate.year = 2000
        refdate = datetime.datetime(2000, 11, 1, 12, 30, 5)
        self.assertEqual(refdate.year, self.testdate.datetime.year)
        with self.assertRaises(ValueError):
            self.testdate.year = 'wrong'
    def test_08_set_month(self):
        self.testdate.month = 5
        refdate = datetime.datetime(1996, 5, 1, 12, 30, 5)
        self.assertEqual(refdate.month, self.testdate.datetime.month)
        with self.assertRaises(ValueError):
            self.testdate.month = 'wrong'
    def test_09_set_day(self):
        self.testdate.day = 30
        refdate = datetime.datetime(1996, 11, 30, 12, 30, 5)
        self.assertEqual(refdate.day, self.testdate.datetime.day)
        with self.assertRaises(ValueError):
            self.testdate.day = 'wrong'
    def test_10_set_hour(self):
        self.testdate.hour = 0
        refdate = datetime.datetime(1996, 11, 1, 0, 30, 5)
        self.assertEqual(refdate.hour, self.testdate.datetime.hour)
        with self.assertRaises(ValueError):
            self.testdate.hour = 'wrong'
    def test_11_set_minute(self):
        self.testdate.minute = 59
        refdate = datetime.datetime(1996, 11, 1, 12, 59, 5)
        self.assertEqual(refdate.minute, self.testdate.datetime.minute)
        with self.assertRaises(ValueError):
            self.testdate.minute = 'wrong'
    def test_12_set_second(self):
        self.testdate.second = 7
        refdate = datetime.datetime(1996, 11, 1, 12, 30, 7)
        self.assertEqual(refdate.second, self.testdate.datetime.second)
        with self.assertRaises(ValueError):
            self.testdate.second = 'wrong'
    def test_13_get_wateryear(self):
        self.assertEqual(self.testdate.wateryear, self.testdate.year+1)
        self.testdate.month = 10
        self.assertEqual(self.testdate.wateryear, self.testdate.year)
    def test_14_set_refmonth(self):
        self.testdate.refmonth = 3
        self.assertEqual(self.testdate.refmonth, 3)
        self.testdate.refmonth = 'July'
        self.assertEqual(self.testdate.refmonth, 7)
        with self.assertRaises(ValueError):
            self.testdate.refmonth = 'Ju'



class Test03DateStyle(unittest.TestCase):

    def setUp(self):
        self.date = timetools.Date('01.11.1996')

    def test_01_remember_style(self):
        self.assertEqual(self.date.style, 'din')
    def test_02_dontforget_style(self):
        self.date.string('iso')
        self.assertEqual(self.date.style, 'din')
    def test_03_change_style(self):
        self.date.style = 'iso'
        self.assertEqual(self.date.style, 'iso')


class Test04DateCopy(unittest.TestCase):

    def setUp(self):
        self.date = timetools.Date('01.11.1996')

    def test_01_ids(self):
        testdate = self.date.copy()
        self.assertNotEqual(id(testdate), id(self.date))
    def test_02_values(self):
        testdate = self.date.copy()
        testdate.year = 2000
        self.assertNotEqual(testdate.datetime.year, self.date.datetime.year)


class Test05DateComparisons(unittest.TestCase):

    def setUp(self):
        self.early1 = timetools.Date('01.11.1996')
        self.early2 = timetools.Date('01.11.1996')
        self.late = timetools.Date('01.11.1997')

    def test_01_lt(self):
        self.assertTrue(self.early1 < self.late)
        self.assertFalse(self.early1 < self.early2)
        self.assertFalse(self.late < self.early2)
    def test_021_le(self):
        self.assertTrue(self.early1 <= self.late)
        self.assertTrue(self.early1 <= self.early2)
        self.assertFalse(self.late <= self.early2)
    def test_03_eq(self):
        self.assertFalse(self.early1 == self.late)
        self.assertTrue(self.early1 == self.early2)
        self.assertFalse(self.late == self.early2)
    def test_04_ne(self):
        self.assertTrue(self.early1 != self.late)
        self.assertFalse(self.early1 != self.early2)
        self.assertTrue(self.late != self.early2)
    def test_05_gt(self):
        self.assertFalse(self.early1 > self.late)
        self.assertFalse(self.early1 > self.early2)
        self.assertTrue(self.late > self.early2)
    def test_06_ge(self):
        self.assertFalse(self.early1 >= self.late)
        self.assertTrue(self.early1 >= self.early2)
        self.assertTrue(self.late >= self.early2)


class Test06DateArithmetic(unittest.TestCase):

    def setUp(self):
        self.earlydate = timetools.Date('01.11.1996')
        self.latedate = timetools.Date('01.11.1997')
        self.period = timetools.Period('365d')

    def test_01_add(self):
        testdate = self.earlydate + self.period
        self.assertEqual(self.latedate, testdate)
        self.assertEqual(testdate.style, 'din')
    def test_02_iadd(self):
        self.earlydate += self.period
        self.assertEqual(self.earlydate, self.latedate)
        self.assertEqual(self.earlydate.style, 'din')
    def test_03_sub(self):
        testdate = self.latedate - self.period
        self.assertEqual(self.earlydate, testdate)
        self.assertEqual(testdate.style, 'din')
    def test_04_isub(self):
        self.latedate -= self.period
        self.assertEqual(self.latedate, self.earlydate)
        self.assertEqual(self.latedate.style, 'din')


class Test07PeriodInitialization(unittest.TestCase):

    def test_01_string_day(self):
        self.assertEqual(datetime.timedelta(1),
                         timetools.Period('1d').timedelta)
        self.assertEqual(datetime.timedelta(365),
                         timetools.Period('365d').timedelta)
    def test_02_string_hour(self):
        self.assertEqual(datetime.timedelta(0, 60*60),
                         timetools.Period('1h').timedelta)
    def test_03_string_minute(self):
        self.assertEqual(datetime.timedelta(0, 60),
                         timetools.Period('1m').timedelta)
    def test_04_string_second(self):
        self.assertEqual(datetime.timedelta(0, 1),
                         timetools.Period('1s').timedelta)
    def test_05_timedelta(self):
        timedelta = datetime.timedelta(365)
        self.assertEqual(timedelta, timetools.Period(timedelta).timedelta)



class Test08PeriodProperties(unittest.TestCase):

    def setUp(self):
        seconds = int(60*60*24*365*3.2)
        self.refperiod = datetime.timedelta(0, seconds)
        self.testperiod = timetools.Period('%ds' % seconds)

    def test_01_get_days(self):
        self.assertEqual(self.refperiod.total_seconds()/60/60/24,
                         self.testperiod.days)
    def test_02_get_hours(self):
        self.assertEqual(self.refperiod.total_seconds()/60/60,
                         self.testperiod.hours)
    def test_03_get_minutes(self):
        self.assertEqual(self.refperiod.total_seconds()/60,
                         self.testperiod.minutes)
    def test_04_get_seconds(self):
        self.assertEqual(self.refperiod.total_seconds(),
                         self.testperiod.seconds)


class Test09PeriodUnit(unittest.TestCase):

    def test_01_day(self):
        self.assertEqual(timetools.Period('365d').unit, 'd')
        self.assertEqual(timetools.Period('1d').unit, 'd')
        self.assertEqual(timetools.Period('24h').unit, 'd')
        self.assertEqual(timetools.Period('1440m').unit, 'd')
        self.assertEqual(timetools.Period('86400m').unit, 'd')
    def test_02_hour(self):
        self.assertEqual(timetools.Period('25h').unit, 'h')
        self.assertEqual(timetools.Period('1h').unit, 'h')
        self.assertEqual(timetools.Period('60m').unit, 'h')
        self.assertEqual(timetools.Period('3600s').unit, 'h')
    def test_03_minute(self):
        self.assertEqual(timetools.Period('777m').unit, 'm')
        self.assertEqual(timetools.Period('1m').unit, 'm')
        self.assertEqual(timetools.Period('60s').unit, 'm')
    def test_04_second(self):
        self.assertEqual(timetools.Period('999s').unit, 's')
        self.assertEqual(timetools.Period('1s').unit, 's')


class Test10PeriodCopy(unittest.TestCase):

    def setUp(self):
        self.period = timetools.Period('1d')

    def test_01_ids(self):
        testperiod = self.period.copy()
        self.assertNotEqual(id(testperiod), id(self.period))
    def test_02_values(self):
        testperiod = self.period.copy()
        testperiod += '1d'
        self.assertNotEqual(testperiod.timedelta,
                            self.period.timedelta)



class Test11PeriodComparisons(unittest.TestCase):

    def setUp(self):
        self.short1 = timetools.Period('1h')
        self.short2 = timetools.Period('1h')
        self.long = timetools.Period('1d')

    def test_01_lt(self):
        self.assertTrue(self.short1 < self.long)
        self.assertFalse(self.short1 < self.short2)
        self.assertFalse(self.long < self.short2)
    def test_021_le(self):
        self.assertTrue(self.short1 <= self.long)
        self.assertTrue(self.short1 <= self.short2)
        self.assertFalse(self.long <= self.short2)
    def test_03_eq(self):
        self.assertFalse(self.short1 == self.long)
        self.assertTrue(self.short1 == self.short2)
        self.assertFalse(self.long == self.short2)
    def test_04_ne(self):
        self.assertTrue(self.short1 != self.long)
        self.assertFalse(self.short1 != self.short2)
        self.assertTrue(self.long != self.short2)
    def test_05_gt(self):
        self.assertFalse(self.short1 > self.long)
        self.assertFalse(self.short1 > self.short2)
        self.assertTrue(self.long > self.short2)
    def test_06_ge(self):
        self.assertFalse(self.short1 >= self.long)
        self.assertTrue(self.short1 >= self.short2)
        self.assertTrue(self.long >= self.short2)
#    def test_07_true(self):
#        self.assertTrue(self.short1)
#        self.assertTrue(self.long)
#        self.assertFalse(timetools.Period('0d'))


class Test12PeriodArithmetic(unittest.TestCase):

    def setUp(self):
        self.year97 = timetools.Date('01.11.1996')
        self.year98 = timetools.Date('01.11.1997')
        self.oneyear = timetools.Period('365d')
        self.oneday = timetools.Period('1d')

    def test_01_add(self):
        testdate = self.oneyear + self.year97
        self.assertEqual(self.year98, testdate)
        self.assertEqual(testdate.style, 'din')
        self.assertEqual(self.oneyear + self.oneday, timetools.Period('366d'))
    def test_02_iadd(self):
        self.oneyear += self.oneday
        self.assertEqual(self.oneyear, timetools.Period('366d'))
    def test_03_sub(self):
        testdate = self.year98 - self.oneyear
        self.assertEqual(self.year97, testdate)
    def test_04_isub(self):
        self.oneyear -= self.oneday
        self.assertEqual(self.oneyear, timetools.Period('364d'))
    def test_05_mul(self):
        testperiod = self.oneday * 365
        self.assertEqual(testperiod, self.oneyear)
    def test_06_rmul(self):
        testperiod = 365 * self.oneday
        self.assertEqual(testperiod, self.oneyear)
    def test_07_imul(self):
        self.oneday *= 365
        self.assertEqual(self.oneday, self.oneyear)
    def test_08_div(self):
        testperiod = self.oneyear / self.oneday
        self.assertEqual(testperiod, 365)
        testinteger = self.oneyear / 365
        self.assertEqual(testinteger, self.oneday)
    def test_09_idiv(self):
        self.oneyear /= 365
        self.assertEqual(self.oneyear,  self.oneday)
    def test_10_mod(self):
        self.assertFalse(self.oneyear % self.oneday)
        self.assertTrue(self.oneyear % timetools.Period('360d'))
    def test_11_floordiv(self):
        self.assertTrue(self.oneyear // self.oneday)
        self.assertFalse(self.oneyear // timetools.Period('360d'))


class Test13TimegridInitialization(unittest.TestCase):

    def setUp(self):
        self.year97 = timetools.Date('01.11.1996')
        self.year98 = timetools.Date('01.11.1997')
        self.oneday = timetools.Period('1d')

    def test_01_right(self):
        timetools.Timegrid(self.year97, self.year98, self.oneday)
    def test_02_wrong(self):
        with self.assertRaises(ValueError):
            timetools.Timegrid(self.year97, self.year97, self.oneday)
        with self.assertRaises(ValueError):
            timetools.Timegrid(self.year98, self.year97, self.oneday)
        with self.assertRaises(ValueError):
            timetools.Timegrid(self.year97, self.year98,
                               timetools.Period('360d'))


class Test14TimegridIterable(unittest.TestCase):

    def setUp(self):
        self.year97 = timetools.Date('01.11.1996')
        self.year98 = timetools.Date('01.11.1997')
        self.oneday = timetools.Period('1d')
        self.timegrid = timetools.Timegrid(self.year97, self.year98,
                                           self.oneday)

    def test_01_indexing_with_integers(self):
        self.assertEqual(self.timegrid[0], self.year97)
        self.assertEqual(self.timegrid[365], self.year98)
        self.assertEqual(self.timegrid[1], self.year97+self.oneday)
        self.assertEqual(self.timegrid[-1], self.year97-self.oneday)
        self.assertEqual(self.timegrid[366], self.year98+self.oneday)
        self.assertEqual(self.timegrid[364], self.year98-self.oneday)

    def test_02_indexing_with_dates(self):
        self.assertEqual(self.timegrid[self.year97], 0)
        self.assertEqual(self.timegrid[self.year98], 365)
        self.assertEqual(self.timegrid[self.year97+self.oneday], 1)
        self.assertEqual(self.timegrid[self.year97-self.oneday], -1)
        self.assertEqual(self.timegrid[self.year98+self.oneday], 366)
        self.assertEqual(self.timegrid[self.year98-self.oneday], 364)

    def test_03_indexing_errors(self):
        with self.assertRaises(TypeError):
            self.timegrid[0.]
        with self.assertRaises(ValueError):
            self.timegrid[self.year97 + '1m']

    def test_04_iteration(self):
        self.assertEqual(list(self.timegrid)[1], self.year97+self.oneday)

    def test_05_len(self):
        self.assertEqual(len(self.timegrid), 365)


class Test15TimegridComparisons(unittest.TestCase):

    def setUp(self):
        self.year97 = timetools.Date('01.11.1996')
        self.year98 = timetools.Date('01.11.1997')
        self.oneday = timetools.Period('1d')
        self.onehour = timetools.Period('1h')
        self.timegrid = timetools.Timegrid(self.year97, self.year98,
                                           self.oneday)

    def test_01_eq(self):
        timegridtest = self.timegrid.copy()
        self.assertTrue(timegridtest == self.timegrid)
        timegridtest.firstdate.year = 1995
        self.assertFalse(timegridtest == self.timegrid)
        timegridtest = self.timegrid.copy()
        timegridtest.lastdate.year = 1998
        self.assertFalse(timegridtest == self.timegrid)
        timegridtest = self.timegrid.copy()
        timegridtest.stepsize = self.onehour
        self.assertFalse(timegridtest == self.timegrid)

    def test_02_ne(self):
        timegridtest = self.timegrid.copy()
        self.assertFalse(timegridtest != self.timegrid)
        timegridtest.firstdate.year = 1995
        self.assertTrue(timegridtest != self.timegrid)
        timegridtest = self.timegrid.copy()
        timegridtest.lastdate.year = 1998
        self.assertTrue(timegridtest != self.timegrid)
        timegridtest = self.timegrid.copy()
        timegridtest.stepsize = self.onehour
        self.assertTrue(timegridtest != self.timegrid)

    def test_03_date_in(self):
        self.assertTrue(self.year97 in self.timegrid)
        self.assertTrue(self.year98 in self.timegrid)
        self.assertTrue(self.year97+'1d' in self.timegrid)
        self.assertFalse(self.year97-'1d' in self.timegrid)
        self.assertTrue(self.year98-'1d' in self.timegrid)
        self.assertFalse(self.year98+'1d' in self.timegrid)
        self.assertFalse(self.year97+'12h' in self.timegrid)
        self.assertFalse(self.year97-'12h' in self.timegrid)
        self.assertFalse(self.year98-'12h' in self.timegrid)
        self.assertFalse(self.year98+'12h' in self.timegrid)

    def test_04_timegrid_in(self):
        timegridtest = self.timegrid.copy()
        self.assertTrue(timegridtest in self.timegrid)
        self.assertTrue(self.timegrid in timegridtest)
        timegridtest.firstdate -= '1d'
        self.assertFalse(timegridtest in self.timegrid)
        self.assertTrue(self.timegrid in timegridtest)
        timegridtest = self.timegrid.copy()
        timegridtest.lastdate += '1d'
        self.assertFalse(timegridtest in self.timegrid)
        self.assertTrue(self.timegrid in timegridtest)
        timegridtest = self.timegrid.copy()
        timegridtest.firstdate -= '1d'
        timegridtest.lastdate += '1d'
        self.assertFalse(timegridtest in self.timegrid)
        self.assertTrue(self.timegrid in timegridtest)
        timegridtest = self.timegrid.copy()
        timegridtest.firstdate += '12h'
        timegridtest.lastdate -= '12d'
        self.assertFalse(timegridtest in self.timegrid)
        self.assertFalse(self.timegrid in timegridtest)
        timegridtest = self.timegrid.copy()
        timegridtest.stepsize /= 24
        self.assertFalse(timegridtest in self.timegrid)
        self.assertFalse(self.timegrid in timegridtest)

unittests_03_filetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  

# import...
# ...from standard library
#from __future__ import division, print_function
#import os
#import unittest
## ...from HydPy
#from hydpy.core import filetools
#from hydpy import pub
#
#PROJECTNAME = 'projectnamemock'
#
#class NetworkFileMock(filetools.NetworkFile):
#    def checkpath(self):
#        pass
#
#class Test02NetwortFile(unittest.TestCase):
#
#    def setUp(self):
#        pub.projectname = PROJECTNAME
#        self.testdirectory = os.path.abspath('controlfiles')
#
#    def test_01_getdirectory(self):
#        networkfile = NetworkFileMock()
#        self.assertEqual(networkfile.directory, self.testdirectory)
#
#    def test_02_getfilename(self):
#        networkfile = NetworkFileMock()
#        self.assertEqual(networkfile.filename, PROJECTNAME+'_network.py')
#        networkfile._filename = 'testname'
#        self.assertEqual(networkfile.filename, 'testname.py')
#
#    def test_03_setwrongfilename(self):
#        with self.assertRaises(IOError):
#             filetools.NetworkFile('testname')
#
#    def test_04_setcorrectfilename(self):
#        networkfile = NetworkFileMock('testname')
#        self.assertEqual(networkfile.filename, 'testname.py')
#        networkfile = NetworkFileMock('testname.py')
#        self.assertEqual(networkfile.filename, 'testname.py')
#        networkfile.filename = None
#        self.assertEqual(networkfile.filename, PROJECTNAME+'_network.py')
#        networkfile = NetworkFileMock()
#        networkfile.filename = 'testname'
#        self.assertEqual(networkfile.filename, 'testname.py')
#
#    def test_5_savefile(self):
#        pass

unittests_04_devicetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  

# import...
# ...from standard library
from __future__ import division, print_function
import unittest
# ...from HydPy
from hydpy.core.devicetools import *
from hydpy.core.connectiontools import *



class Test01NodeCreation(unittest.TestCase):

    def tearDown(self):
        Element.clear_registry()
        Node.clear_registry()

    def test_01_fromstring(self):
        test1a = Node('test1')
        self.assertIsInstance(test1a, Node)
        self.assertEqual(test1a.name, 'test1')
        test1b = Node('test1')
        self.assertIs(test1a, test1b)
        test2 = Node('test2')
        self.assertIsNot(test1a, test2)
    def test_02_fromnode(self):
        test1 = Node('test')
        test2 = Node(test1)
        self.assertIsInstance(test2, Node)
        self.assertIs(test1, test2)
        with self.assertRaises(ValueError):
            Node([test1, test2])
    def test_03_fromwronginput(self):
        with self.assertRaises(ValueError):
            test = Node(['test'])
        with self.assertRaises(ValueError):
            test = Node(5)
        with self.assertRaises(ValueError):
            test = Node({'test': 'test'})
    def test_04_attributes(self):
        test1 = Node('test1')
        self.assertIsInstance(test1.entries, Connections)
        self.assertIsInstance(test1.exits, Connections)
        self.assertEqual(test1.variable, 'Q')
        test2 = Node('test2', 'T')
        self.assertIsInstance(test2.entries, Connections)
        self.assertIsInstance(test2.exits, Connections)
        self.assertEqual(test2.variable, 'T')
    def test_03_wrongredefinition(self):
        test = Node('test')
        with self.assertRaises(ValueError):
            Node('test', 'T')


class Test02ElementCreation(unittest.TestCase):

    def tearDown(self):
        Element.clear_registry()
        Node.clear_registry()

    def test_01_fromstring(self):
        test1a = Element('test1')
        self.assertIsInstance(test1a, Element)
        self.assertEqual(test1a.name, 'test1')
        test1b = Element('test1')
        self.assertIs(test1a, test1b)
        test2 = Element('test2')
        self.assertIsNot(test1a, test2)
    def test_02_fromelement(self):
        test1 = Element('test')
        test2 = Element(test1)
        self.assertIsInstance(test2, Element)
        self.assertIs(test1, test2)
        with self.assertRaises(ValueError):
            Element([test1, test2])
    def test_03_fromwronginput(self):
        with self.assertRaises(ValueError):
            test = Element(['test'])
        with self.assertRaises(ValueError):
            test = Element(5)
        with self.assertRaises(ValueError):
            test = Element({'test': 'test'})
    def test_04_attributes(self):
        test = Element('test')
        self.assertIsInstance(test.inlets, Connections)
        self.assertIsInstance(test.outlets, Connections)
        self.assertIsInstance(test.receivers, Connections)
        self.assertIsInstance(test.senders, Connections)
        self.assertIsNone(test.model)


class Test03ElementInitialization(unittest.TestCase):

    def setUp(self):
        self.n1Q = Node('n1Q', 'Q')
        self.n2Q = Node('n2Q', 'Q')
        self.n3W = Node('n3W', 'W')
        self.n4T = Node('n4T', 'T')

    def tearDown(self):
        Element.clear_registry()
        Node.clear_registry()

    def test_01_inlet(self):
        e = Element('e', inlets=self.n1Q)
        self.assertIsInstance(e, Element)
        self.assertIs(e.inlets.n1Q, self.n1Q)
        self.assertIsInstance(self.n1Q.exits.e, Element)
        self.assertIs(self.n1Q.exits.e, e)
        self.assertIs(e.inlets.n1Q, self.n1Q)
        e = Element('e', inlets=self.n1Q)
        self.assertIs(e.inlets.n1Q, self.n1Q)
        e = Element('e', inlets=self.n4T)
        self.assertIs(e.inlets.n1Q, self.n1Q)
        self.assertIs(e.inlets.n4T, self.n4T)
        e = Element('e', inlets=self.n3W)
        self.assertIs(e.inlets.n3W, self.n3W)
        with self.assertRaises(ValueError):
            e = Element('e', outlets=self.n2Q)
            e = Element('e', inlets=self.n2Q)

    def test_02_outlet(self):
        e = Element('e', outlets=self.n1Q)
        self.assertIsInstance(e, Element)
        self.assertIs(e.outlets.n1Q, self.n1Q)
        self.assertIsInstance(self.n1Q.entries.e, Element)
        self.assertIs(self.n1Q.entries.e, e)
        e = Element('e', outlets=self.n1Q)
        self.assertIs(e.outlets.n1Q, self.n1Q)
        e = Element('e', outlets=self.n4T)
        self.assertIs(e.outlets.n1Q, self.n1Q)
        self.assertIs(e.outlets.n4T, self.n4T)
        e = Element('e', outlets=self.n3W)
        self.assertIs(e.outlets.n3W, self.n3W)
        with self.assertRaises(ValueError):
            e = Element('e', inlets=self.n2Q)
            e = Element('e', outlets=self.n2Q)

    def test_03_receiver(self):
        e = Element('e', receivers=self.n1Q)
        self.assertIsInstance(e, Element)
        self.assertIs(e.receivers.n1Q, self.n1Q)
        self.assertIsInstance(self.n1Q.exits.e, Element)
        self.assertIs(self.n1Q.exits.e, e)
        e = Element('e', receivers=self.n1Q)
        self.assertIs(e.receivers.n1Q, self.n1Q)
        e = Element('e', receivers=self.n4T)
        self.assertIs(e.receivers.n1Q, self.n1Q)
        self.assertIs(e.receivers.n4T, self.n4T)
        e = Element('e', receivers=self.n3W)
        self.assertIs(e.receivers.n3W, self.n3W)
        with self.assertRaises(ValueError):
            e = Element('e', senders=self.n2Q)
            e = Element('e', receivers=self.n2Q)

    def test_04_sender(self):
        e = Element('e', senders=self.n1Q)
        self.assertIsInstance(e, Element)
        self.assertIs(e.senders.n1Q, self.n1Q)
        self.assertIsInstance(self.n1Q.entries.e, Element)
        self.assertIs(self.n1Q.entries.e, e)
        e = Element('e', senders=self.n1Q)
        self.assertIs(e.senders.n1Q, self.n1Q)
        e = Element('e', senders=self.n4T)
        self.assertIs(e.senders.n1Q, self.n1Q)
        self.assertIs(e.senders.n4T, self.n4T)
        e = Element('e', senders=self.n3W)
        self.assertIs(e.senders.n3W, self.n3W)
        with self.assertRaises(ValueError):
            e = Element('e', receivers=self.n2Q)
            e = Element('e', senders=self.n2Q)

    def test_05_inletandoutlet(self):
        e1 = Element('e1', inlets=self.n1Q, outlets=self.n2Q)
        self.assertIs(e1.inlets.n1Q, self.n1Q)
        self.assertIs(e1.outlets.n2Q, self.n2Q)
        e2 = Element('e2', inlets=self.n1Q)
        with self.assertRaises(ValueError):
            Element('e2', outlets=self.n1Q)
        e3 = Element('e3', outlets=self.n1Q)
        with self.assertRaises(ValueError):
            Element('e3', inlets=self.n1Q)
        with self.assertRaises(ValueError):
            Element('e4', inlets=self.n1Q, outlets=self.n1Q)

    def test_06_receiverandsender(self):
        e1 = Element('e1', receivers=self.n1Q, senders=self.n2Q)
        self.assertIs(e1.receivers.n1Q, self.n1Q)
        self.assertIs(e1.senders.n2Q, self.n2Q)
        e2 = Element('e2', receivers=self.n1Q)
        with self.assertRaises(ValueError):
            Element('e2', senders=self.n1Q)
        e3 = Element('e3', senders=self.n1Q)
        with self.assertRaises(ValueError):
            Element('e3', receivers=self.n1Q)
        with self.assertRaises(ValueError):
            Element('e4', receivers=self.n1Q, senders=self.n1Q)


#class Test04NodesCreation(unittest.TestCase):
#
#    def setUp(self):
#        asdf

class Test05ElementsCreation(unittest.TestCase):

    def setUp(self):
        self.element1 = Element('element1')
        self.element2 = Element('element2')

    def tearDown(self):
        Element.clear_registry()
        Node.clear_registry()

    def test_00_fromnone(self):
        test = Elements(None)
        self.assertIsInstance(test, Elements)

    def test_01_fromelements(self):
        test = Elements(self.element1)
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        test = Elements(self.element1, self.element2)
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        self.assertIsInstance(test.element2, Element)
        self.assertIs(test.element2, self.element2)

    def test_02_fromstrings(self):
        test = Elements('element1')
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        test = Elements('element1', 'element2')
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        self.assertIsInstance(test.element2, Element)
        self.assertIs(test.element2, self.element2)

    def test_03_fromelements(self):
        test1 = Elements('element1')
        test2 = Elements(test1)
        self.assertIsInstance(test2, Elements)

    def test_04_fromemptycontainer(self):
        test = Elements([])
        self.assertIsInstance(test, Elements)

    def test_05_fromcontaineredelements1(self):
        test = Elements([self.element1])
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        test = Elements([self.element1, self.element2])
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIsInstance(test.element2, Element)
        self.assertIs(test.element1, self.element1)
        self.assertIs(test.element2, self.element2)

    def test_06_fromcontaineredelements1(self):
        test = Elements(Elements([self.element1]))
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        test = Elements(Elements([self.element1, self.element2]))
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIsInstance(test.element2, Element)
        self.assertIs(test.element1, self.element1)
        self.assertIs(test.element2, self.element2)

    def test_07_fromcontaineredstrings(self):
        test = Elements(['element1'])
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIs(test.element1, self.element1)
        test = Elements(['element1', 'element2'])
        self.assertIsInstance(test, Elements)
        self.assertIsInstance(test.element1, Element)
        self.assertIsInstance(test.element2, Element)
        self.assertIs(test.element1, self.element1)
        self.assertIs(test.element2, self.element2)

    def test_07_fromwrongtype(self):
        with self.assertRaises(TypeError):
            Elements(1.)

class Test06ElementsArithmetic(unittest.TestCase):

    def setUp(self):
        self.element1 = Element('element1')
        self.element2 = Element('element2')
        self.element3 = Element('element3')
        self.element4 = Element('element3')
        self.elements12 = Elements(self.element1, self.element2)
        self.elements34 = Elements(self.element3, self.element4)

    def tearDown(self):
        Element.clear_registry()
        Node.clear_registry()

    def test_01_iadd_element(self):
        self.elements12 += self.element3
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        self.assertIs(self.elements12.element3, self.element3)
    def test_02_iadd_elements(self):
        self.elements12 += self.elements34
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        self.assertIs(self.elements12.element3, self.element3)
    def test_03a_iadd_emptylist(self):
        elements12 = self.elements12.copy()
        self.elements12 += []
        self.assertIsInstance(self.elements12, Elements)
        self.assertEqual(self.elements12, elements12)
    def test_04a_iadd_elementlist(self):
        self.elements12 += [self.element3]
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        self.assertIs(self.elements12.element3, self.element3)
    def test_04b_iadd_elementlist(self):
        self.elements12 += [self.element3, self.element4]
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        self.assertIs(self.elements12.element3, self.element3)
    def test_05a_iadd_stringlist(self):
        self.elements12 += ['element3']
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        self.assertIs(self.elements12.element3, self.element3)
    def test_05b_iadd_stringlist(self):
        self.elements12 += ['element3', 'element4']
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        self.assertIs(self.elements12.element3, self.element3)

    def test_06_isub_element(self):
        self.elements12 -= self.element2
        self.assertIsInstance(self.elements12, Elements)
        self.assertIs(self.elements12.element1, self.element1)
        with self.assertRaises(AttributeError):
            self.elements12.element2

    def test_07_add_element(self):
        elements12 = self.elements12.copy()
        elements123 = self.elements12 + self.element3
        self.assertEqual(self.elements12, elements12)
        self.assertIsInstance(elements123, Elements)
        self.assertIs(elements123.element1, self.element1)
        self.assertIs(elements123.element3, self.element3)

    def test_08_sub_element(self):
        elements12 = self.elements12.copy()
        elements1 = self.elements12 - self.element2
        self.assertEqual(self.elements12, elements12)
        self.assertIsInstance(elements1, Elements)
        self.assertIs(elements1.element1, self.element1)
        with self.assertRaises(AttributeError):
            self.elements1.element2


class Test07ElementsComparisons(unittest.TestCase):

    def tearDown(self):
        Element.clear_registry()
        Node.clear_registry()

    def test_01_bool(self):
        self.assertFalse(Elements())
        self.assertTrue(Elements('a'))
        self.assertTrue(Elements('a', 'b'))

unittests_05_connectiontools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  

# import...
# ...from standard library
from __future__ import division, print_function
import unittest
# ...from HydPy
from hydpy.core.devicetools import *
from hydpy.core.connectiontools import *

class Test01Connections(unittest.TestCase):

    def setUp(self):
        self.test1 = Node('test1')
        self.test2 = Node('test2')
        self.cons = Connections(None, 'cons')
        self.cons += self.test1
        self.cons += self.test2

    def test_01_properties(self):
        self.assertListEqual(sorted(self.cons.names),
                             ['test1', 'test2'])
        self.assertListEqual(sorted(self.cons.slaves),
                             [self.test1, self.test2])
    def test_02_contains(self):
        self.assertTrue('test1' in self.cons)
        self.assertTrue('test2' in self.cons)
        self.assertTrue(self.test1 in self.cons)
        self.assertTrue(self.test2 in self.cons)
    def test_03_iterable(self):
        devices = []
        for device in self.cons:
            devices.append(device)
        self.assertListEqual(devices, [self.test1, self.test2])

class Test01Self2Node(unittest.TestCase):

    def tearDown(self):
        Element.clear_registry()

    def test_01_iadd(self):
        test = Connections(None, 'test')
        n1 = Node('n1', 'Q')
        test += n1
        self.assertIsInstance(test, Connections)
        self.assertIsInstance(test.n1, Node)
        self.assertIs(test.n1, n1)
        test += n1
        self.assertIsInstance(test, Connections)
        self.assertIsInstance(test.n1, Node)
        self.assertIs(test.n1, n1)
        n2 = Node('n2', 'T')
        test += n2
        self.assertIs(test.n1, n1)
        self.assertIs(test.n2, n2)

    def test_02_variables(self):
        test = Connections(None, 'test')
        self.assertListEqual(test.variables, [])
        n1 = Node('n1', 'Q')
        test += n1
        self.assertListEqual(test.variables, ['Q'])
        n2 = Node('n2', 'T')
        test += n2
        self.assertListEqual(sorted(test.variables), ['Q', 'T'])
        with self.assertRaises(AttributeError):
            test.X

unittests_06_selectiontools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  

# import...
# ...from standard library
from __future__ import division, print_function
import unittest
# ...from HydPy
from hydpy.core.devicetools import *
from hydpy.core.selectiontools import *

class Test01SelectionInitialization(unittest.TestCase):

    def tearDown(self):
        Node.clear_registry()
        Element.clear_registry()

    def test_01_empty(self):
        test = Selection('test')
        self.assertIsInstance(test, Selection)
        self.assertIsInstance(test.nodes, Nodes)
        self.assertIsInstance(test.elements, Elements)
        self.assertFalse(bool(test))
    def test_02_nonempty(self):
        test = Selection('test', nodes='a', elements=('b', 'c'))
        self.assertIsInstance(test, Selection)
        self.assertIsInstance(test.nodes, Nodes)
        self.assertIsInstance(test.elements, Elements)
        self.assertEqual(test.nodes.a.name, 'a')
        self.assertEqual(test.elements.b.name, 'b')
        self.assertEqual(test.elements.c.name, 'c')
        self.assertTrue(bool(test))
    def test_03_copy(self):
        test1 = Selection('test1', nodes='a', elements=('b', 'c'))
        test2 = test1.copy('test2')
        self.assertIsInstance(test2, Selection)
        self.assertEqual(test2.name, 'test2')
        self.assertIsNot(test1, test2)
        self.assertEqual(test2.nodes, test1.nodes)
        self.assertEqual(test2.elements, test1.elements)


class Test02SelectionSelect(unittest.TestCase):

    def setUp(self):
        # e1 + e2 -> n_Q1 -> e3 -> n_Q2 -> e4 + (e7 -> n_Q4 -> e6)-> n_Q3
        # e1 + e2 -> n_T1 -> e3 -> n_T2 -> e5 -> n_T3
        self.n_Q1 = Node('n_Q1', 'Q')
        self.n_T1 = Node('n_T1', 'T')
        self.e1 = Element('e1', outlets='n_Q1')
        self.e1 = Element('e1', outlets='n_T1')
        self.e2 = Element('e2', outlets='n_Q1')
        self.e2 = Element('e2', outlets='n_T1')
        self.n_Q2 = Node('n_Q2', 'Q')
        self.n_T2 = Node('n_T2', 'T')
        self.e3 = Element('e3', inlets='n_Q1', outlets='n_Q2')
        self.e3 = Element('e3', inlets='n_T1', outlets='n_T2')
        self.n_Q3 = Node('n_Q3', 'Q')
        self.e4 = Element('e4', inlets='n_Q2', outlets='n_Q3')
        self.n_T3 = Node('n_T3', 'T')
        self.e5 = Element('e5', inlets='n_T2', outlets='n_T3')
        self.n_Q4 = Node('n_Q4', 'Q')
        self.e6 = Element('e6', inlets='n_Q4', outlets='n_Q3')
        self.e7 = Element('e7', outlets='n_Q4')

        self.complete = Selection('complete',
                                  nodes=Node.registered_nodes(),
                                  elements=Element.registered_elements())

    def tearDown(self):
        Node.clear_registry()
        Element.clear_registry()

    def test_01_nextelement(self):
        nodes, elements = self.complete._nextelement(self.e1,
                                                  Nodes(), Elements())
        self.assertEqual(nodes, Nodes())
        self.assertEqual(elements, Elements(self.e1))
    def test_02_nextnode(self):
        nodes, elements = self.complete._nextnode(self.n_Q1,
                                                  Nodes(), Elements())
        self.assertEqual(nodes, Nodes(self.n_Q1))
        self.assertEqual(elements, Elements(self.e1, self.e2))
    def test_03_select_upstream(self):
        test = self.complete.copy('test').select_upstream(self.n_Q3)
        reference = self.complete.copy('reference')
        del(reference.elements.e5)
        del(reference.nodes.n_T2)
        del(reference.nodes.n_T3)
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)
    def test_04_deselect_upstream(self):
        test = self.complete.copy('test').deselect_upstream(self.n_Q3)
        reference = Selection('reference', ['n_T2', 'n_T3'], 'e5')
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)

#    def test_05_selectmodelclasses(self):
#        with self.assertRaises(RuntimeError):
#            self.complete.copy('test').getby_modelclasses('HBV96_zone')

    def test_06_select_nodenames(self):
        test = self.complete.copy('test').select_nodenames('n_Q1', 'n_T', 'NO')
        reference = self.complete.copy('test')
        reference.nodes = Nodes('n_Q1', 'n_T1', 'n_T2', 'n_T3')
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)
    def test_07_deselect_nodenames(self):
        test = self.complete.copy('test').deselect_nodenames('n_Q1', 'n_T',
                                                             'NO')
        reference = self.complete.copy('test')
        del(reference.nodes.n_Q1)
        del(reference.nodes.n_T1)
        del(reference.nodes.n_T2)
        del(reference.nodes.n_T3)
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)
    def test_08_select_elementnames(self):
        test = self.complete.copy('test').select_elementnames('e')
        self.assertEqual(test.nodes, self.complete.nodes)
        self.assertEqual(test.elements, self.complete.elements)
        test = self.complete.copy('test').select_elementnames('2')
        reference = self.complete.copy('test')
        reference.elements = Elements('e2')
    def test_09_deselect_elementnames(self):
        test = self.complete.copy('test').deselect_elementnames('e')
        self.assertEqual(test.nodes, self.complete.nodes)
        self.assertEqual(test.elements, Elements())
        test = self.complete.copy('test').deselect_elementnames('2')
        reference = self.complete.copy('test')
        del(reference.elements.e2)
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)


class Test03SelectionMagic(unittest.TestCase):

    def tearDown(self):
        Node.clear_registry()
        Element.clear_registry()

    def test_01_len(self):
        test1 = Selection('test1', ['n1', 'n2'], [])
        self.assertEqual(len(test1), 2)
        test2 = Selection('test2', [], ['e1'])
        self.assertEqual(len(test2), 1)

    def test_02_iadd(self):
        test = Selection('sel',
                         ['n1', 'n2', 'n3'],
                         ['e1', 'e2', 'e3'])
        test += Selection('add', ['n3', 'n4'], [])
        reference = Selection('sel',
                              ['n1', 'n2', 'n3', 'n4'],
                              ['e1', 'e2', 'e3'])
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)
        test += Selection('add', [], ['e4', 'e5'])
        reference = Selection('sel',
                              ['n1', 'n2', 'n3', 'n4'],
                              ['e1', 'e2', 'e3', 'e4', 'e5'])
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)
    def test_03_isub(self):
        test = Selection('sel',
                         ['n1', 'n2', 'n3'],
                         ['e1', 'e2', 'e3'])
        test -= Selection('sub', ['n3', 'n4'], [])
        reference = Selection('sel',
                              ['n1', 'n2'],
                              ['e1', 'e2', 'e3'])
        test -= Selection('sub', [], ['e1', 'e2', 'e3'])
        reference = Selection('sel',
                              ['n1', 'n2'],
                              [])
        self.assertEqual(test.nodes, reference.nodes)
        self.assertEqual(test.elements, reference.elements)

unittests_07_parametertools.py

1  
2  
3  
4  
5  
6  
7  
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 01 10:53:44 2016

@author: tyralla
"""

unittests_08_indextools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
# import...
# ...from standard library
from __future__ import division, print_function
import unittest
# ...from site-packages
import numpy
# ...from HydPy
from hydpy import pub
from hydpy.core import indextools
from hydpy.core import timetools

class Test01MonthOfYear(unittest.TestCase):

    def setUp(self):
        self.indexer = indextools.Indexer()

    def tearDown(self):
        pub.timegrids = None

    def test_01_manual_mode(self):
        with self.assertRaises(BaseException):
            self.indexer.monthofyear = 'a'
        with self.assertRaises(BaseException):
            self.indexer.monthofyear = ['a', 'b']
        with self.assertRaises(ValueError):
            self.indexer.monthofyear = [[1, 2], [3, 4]]
        self.indexer.monthofyear = [1,2]
        self.assertIsInstance(self.indexer.monthofyear, numpy.ndarray)
        self.assertTupleEqual(tuple(self.indexer.monthofyear), (1, 2))
        del(self.indexer.monthofyear)
        self.assertIsNone(self.indexer._monthofyear)
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2004',
                                                               '1.01.2005',
                                                               '1d'))
        with self.assertRaises(ValueError):
            self.indexer.monthofyear = [1,2]

    def test_02_automatic_mode(self):
        with self.assertRaises(RuntimeError):
            self.indexer.monthofyear
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2004',
                                                               '1.01.2005',
                                                               '1d'))
        self.assertIsInstance(self.indexer.monthofyear, numpy.ndarray)
        self.assertEqual(len(self.indexer.monthofyear), 366)
        self.assertTupleEqual(tuple(self.indexer.monthofyear),
                              tuple(31*[0]+29*[1]+31*[2]+30*[3]+
                                    31*[4]+30*[5]+31*[6]+31*[7]+
                                    30*[8]+31*[9]+30*[10]+31*[11]))
        self.assertIs(self.indexer.monthofyear, self.indexer.monthofyear)


class Test02DayOfYear(unittest.TestCase):

    def setUp(self):
        self.indexer = indextools.Indexer()

    def tearDown(self):
        pub.timegrids = None

    def test_01_manual_mode(self):
        with self.assertRaises(BaseException):
            self.indexer.dayofyear = 'a'
        with self.assertRaises(BaseException):
            self.indexer.dayofyear = ['a', 'b']
        with self.assertRaises(ValueError):
            self.indexer.dayofyear = [[1, 2], [3, 4]]
        self.indexer.dayofyear = [1,2]
        self.assertIsInstance(self.indexer.dayofyear, numpy.ndarray)
        self.assertTupleEqual(tuple(self.indexer.dayofyear), (1, 2))
        del self.indexer.dayofyear
        self.assertIsNone(self.indexer._dayofyear)
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2004',
                                                               '1.01.2005',
                                                               '1d'))
        with self.assertRaises(ValueError):
            self.indexer.dayofyear = [1,2]

    def test_02_automatic_mode(self):
        with self.assertRaises(RuntimeError):
            self.indexer.dayofyear
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2004',
                                                               '1.01.2005',
                                                               '1d'))
        self.assertIsInstance(self.indexer.dayofyear, numpy.ndarray)
        self.assertEqual(len(self.indexer.dayofyear), 366)
        self.assertTupleEqual(tuple(self.indexer.dayofyear),
                              tuple(range(366)))
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2005',
                                                               '1.01.2006',
                                                               '1d'))
        del self.indexer.dayofyear
        self.assertIsInstance(self.indexer.dayofyear, numpy.ndarray)
        self.assertEqual(len(self.indexer.dayofyear), 365)
        self.assertTupleEqual(
           tuple(self.indexer.dayofyear),
           tuple(list(range(31+28))+list(range(31+28+1, 366)))
           )
        self.assertIs(self.indexer.dayofyear, self.indexer.dayofyear)

class Test03TimeOfYear(unittest.TestCase):

    def setUp(self):
        self.indexer = indextools.Indexer()

    def tearDown(self):
        pub.timegrids = None

    def test_01_manual_mode(self):
        with self.assertRaises(BaseException):
            self.indexer.timeofyear = 'a'
        with self.assertRaises(BaseException):
            self.indexer.timeofyear = ['a', 'b']
        with self.assertRaises(ValueError):
            self.indexer.timeofyear = [[1, 2], [3, 4]]
        self.indexer.timeofyear = [1, 2]
        self.assertIsInstance(self.indexer.timeofyear, numpy.ndarray)
        self.assertTupleEqual(tuple(self.indexer.timeofyear), (1, 2))
        del self.indexer.timeofyear
        self.assertIsNone(self.indexer._timeofyear)
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2004',
                                                               '1.01.2005',
                                                               '1d'))
        with self.assertRaises(ValueError):
            self.indexer.timeofyear = [1, 2]

    def test_02_automatic_mode(self):
        with self.assertRaises(RuntimeError):
            self.indexer.timeofyear
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2004',
                                                               '1.01.2005',
                                                               '1d'))
        self.assertIsInstance(self.indexer.timeofyear, numpy.ndarray)
        self.assertEqual(len(self.indexer.timeofyear), 366)
        self.assertTupleEqual(tuple(self.indexer.timeofyear),
                              tuple(range(366)))
        pub.timegrids = timetools.Timegrids(timetools.Timegrid('01.01.2005',
                                                               '1.01.2006',
                                                               '1d'))
        del self.indexer.timeofyear
        self.assertIsInstance(self.indexer.timeofyear, numpy.ndarray)
        self.assertEqual(len(self.indexer.timeofyear), 365)
        self.assertTupleEqual(
           tuple(self.indexer.timeofyear),
           tuple(list(range(31+28))+list(range(31+28+1, 366)))
           )
        self.assertIs(self.indexer.timeofyear, self.indexer.timeofyear)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
"""
HydPy

An interactive framework for the developement and a application of
hydrological models.
"""
# import...
# ...from standard library
import sys
import warnings
try:
    import builtins
except ImportError:
    import __builtin__ as builtins
# ...from site-packages
from hydpy.core.exceptiontools import OptionalImport
import numpy
from numpy import nan
from scipy import integrate
pandas = OptionalImport('import pandas')
pyplot = OptionalImport('from matplotlib import pyplot')
# ...from HydPy
from hydpy import pub
from hydpy.core import dummytools
from hydpy.core import indextools
from hydpy.core import optiontools
from hydpy.cythons import configutils
from hydpy.core.autodoctools import prepare_mainsubstituter
from hydpy.core.auxfiletools import Auxfiler
from hydpy.core.devicetools import Element
from hydpy.core.devicetools import Elements
from hydpy.core.devicetools import Node
from hydpy.core.devicetools import Nodes
from hydpy.core.hydpytools import HydPy
from hydpy.core.importtools import prepare_model
from hydpy.core.importtools import reverse_model_wildcard_import
from hydpy.core.objecttools import HydPyDeprecationWarning
from hydpy.core.objecttools import print_values
from hydpy.core.objecttools import round_
from hydpy.core.selectiontools import Selection
from hydpy.core.selectiontools import Selections
from hydpy.core.timetools import Date
from hydpy.core.timetools import Period
from hydpy.core.timetools import Timegrid
from hydpy.core.timetools import Timegrids
from hydpy.core.testtools import IntegrationTest
from hydpy.core.testtools import Open
from hydpy.core.testtools import UnitTest
from hydpy.auxs.armatools import ARMA
from hydpy.auxs.armatools import MA
from hydpy.auxs.anntools import ANN
from hydpy.auxs.anntools import ann
from hydpy.auxs.anntools import SeasonalANN
from hydpy.auxs.iuhtools import LinearStorageCascade
from hydpy.auxs.iuhtools import TranslationDiffusionEquation
from hydpy.auxs.networktools import RiverBasinNumber
from hydpy.auxs.networktools import RiverBasinNumbers
from hydpy.auxs.networktools import RiverBasinNumbers2Selection
from hydpy.auxs.statstools import bias_abs
from hydpy.auxs.statstools import bias_rel
from hydpy.auxs.statstools import calc_mean_time
from hydpy.auxs.statstools import calc_mean_time_deviation
from hydpy.auxs.statstools import corr
from hydpy.auxs.statstools import evaluationtable
from hydpy.auxs.statstools import hsepd
from hydpy.auxs.statstools import hsepd_manual
from hydpy.auxs.statstools import hsepd_pdf
from hydpy.auxs.statstools import nse
from hydpy.auxs.statstools import prepare_arrays
from hydpy.auxs.statstools import std_ratio


pub.options = optiontools.Options()
pub.indexer = indextools.Indexer()
pub.config = configutils.Config()
dummies = dummytools.Dummies()   # pylint: disable=invalid-name


def customwarn(message, category, filename, lineno, file=None, line=None):
    """Redirect warnings to `stdout`."""
    sys.stdout.write(warnings.formatwarning(
        message, category, filename, lineno))


warnings.showwarning = customwarn
warnings.filterwarnings('always', category=HydPyDeprecationWarning)
warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
warnings.filterwarnings('error', category=integrate.IntegrationWarning)

# Numpy introduced new string representations in version 1.14 affecting
# our doctests.  Hence, the old style is selected for now:
try:
    # pylint: disable=unexpected-keyword-arg
    numpy.set_printoptions(legacy='1.13')
except TypeError:
    pass

substituter = prepare_mainsubstituter()


__all__ = ['builtins',
           'pandas',
           'pyplot',
           'pub',
           'Auxfiler',
           'Element',
           'Elements',
           'Node',
           'Nodes',
           'HydPy',
           'prepare_model',
           'reverse_model_wildcard_import',
           'print_values',
           'round_',
           'Selection',
           'Selections',
           'Date',
           'Period',
           'Timegrid',
           'Timegrids',
           'IntegrationTest',
           'Open',
           'UnitTest',
           'ARMA',
           'MA',
           'ANN',
           'ann',
           'SeasonalANN',
           'LinearStorageCascade',
           'TranslationDiffusionEquation',
           'RiverBasinNumber',
           'RiverBasinNumbers',
           'RiverBasinNumbers2Selection',
           'nan',
           'bias_abs',
           'bias_rel',
           'calc_mean_time',
           'calc_mean_time_deviation',
           'corr',
           'evaluationtable',
           'hsepd',
           'hsepd_manual',
           'hsepd_pdf',
           'nse',
           'prepare_arrays',
           'std_ratio']

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/config.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
# -*- coding: utf-8 -*-
"""Module |config| allows the user to configure `HydPy`.

The available options should not be changed during runtime.
"""
use_autodoc = True
"""Flag that indicates whether HydPy's automatic documentation manipulation
features should be applyied or not.  It is imperative to set it to `True`
before one uses `Sphinx` to generate the online documentation.  However,
one can set it to `False` for regular applications, which reduces HydPy's
initialisation time."""

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/pub.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  

# import from...
# ...the standard library
import sys as _sys

projectname = None

options = None
indexer = None
networkmanager = None
controlmanager = None
conditionmanager = None
sequencemanager = None
timegrids = None

pyversion = int(_sys.version[0])
_printprogress_indentation = -4

_is_hydpy_bundled = getattr(_sys, 'frozen', False)
"""This parameter is set `True` within HydPy executables only.
Then different features that do not make much sense within an
executable (e.g. the cythonization of models) are disabled.
"""

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/__init__.py

1  
#

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/anntools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
1745  
1746  
1747  
1748  
1749  
1750  
1751  
1752  
1753  
1754  
1755  
1756  
1757  
1758  
1759  
1760  
1761  
1762  
1763  
1764  
1765  
1766  
1767  
1768  
1769  
1770  
1771  
1772  
1773  
1774  
1775  
1776  
1777  
1778  
1779  
1780  
1781  
1782  
1783  
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  
1792  
1793  
1794  
1795  
1796  
1797  
1798  
1799  
1800  
1801  
1802  
1803  
1804  
1805  
1806  
1807  
1808  
1809  
1810  
1811  
1812  
1813  
1814  
1815  
1816  
1817  
1818  
1819  
1820  
1821  
1822  
1823  
1824  
1825  
1826  
1827  
1828  
1829  
1830  
1831  
1832  
1833  
1834  
1835  
1836  
1837  
1838  
1839  
# -*- coding: utf-8 -*-
"""This module implements rudimantary artificial neural network tools,
required for some models implemented in the HydPy framework.

A note for developers: some of the implemented features are to be applied
during model simulations are in some other way performance-critical.  Hence,
the actual calculations are defined in the Cython extension module
|annutils|.
"""

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
from hydpy import pyplot
# ...from HydPy
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import exceptiontools
from hydpy.core import objecttools
from hydpy.core import parametertools
from hydpy.core import timetools
from hydpy.cythons import annutils   # pylint: disable=no-name-in-module


class ANN(object):
    """Multi-layer feed forward artificial neural network.

    The applied activation function is the logistic function:

      :math:`f(x) = \\frac{1}{1+exp(-x)}`

    Class |anntools.ANN| is intended to be subclassed for the derivation of
    very complex control parameters.  Its original purpose was to allow for
    defining arbitrary continuous relationsships between the water stored
    in a dam and the associated water stage (see model ...).  However,
    class |anntools.ANN| can also be applied directly, as shown in the
    following examples.  But if you are looking for a flexible stand-alone
    artifical neural network implementation in Python, you will find much
    more general tools easily.

    Firstly, define the most single artificial neural network consisting of
    only one input node, neuron, and output node respectively, and pass
    some arbitrary network parameters:

    >>> from hydpy import ANN, nan
    >>> ann = ANN()
    >>> ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...     weights_input=4.0, weights_output=3.0,
    ...     intercepts_hidden=-16.0, intercepts_output=-1.0)

    The following loop subsequently sets the values 0 to 8 as input values,
    performs the calculateion, and prints out the final output.  As to be
    expected, the results show the shape of the logistic function:

    >>> from hydpy import round_
    >>> for input_ in range(9):
    ...     ann.inputs[0] = input_
    ...     ann.process_actual_input()
    ...     round_([input_, ann.outputs[0]])
    0, -1.0
    1, -0.999982
    2, -0.998994
    3, -0.946041
    4, 0.5
    5, 1.946041
    6, 1.998994
    7, 1.999982
    8, 2.0

    One can also directly plot the resulting graph:

    >>> ann.plot(0.0, 8.0)

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    The following example shows that everything works well for more complex
    single layer networks also (manual tests have been performed in a
    spreadsheet program):

    >>> ann.nmb_inputs = 3
    >>> ann.nmb_neurons = (4,)
    >>> ann.nmb_outputs = 2
    >>> ann.weights_input = [[ 0.2, -0.1, -1.7,  0.6],
    ...                      [ 0.9,  0.2,  0.8,  0.0],
    ...                      [-0.5, -1.0,  2.3, -0.4]]
    >>> ann.weights_output = [[ 0.0,  2.0],
    ...                       [-0.5,  1.0],
    ...                       [ 0.4,  2.4],
    ...                       [ 0.8, -0.9]]
    >>> ann.intercepts_hidden = [ 0.9,  0.0, -0.4, -0.2]
    >>> ann.intercepts_output = [ 1.3, -2.0]
    >>> ann.inputs = [-0.1,  1.3,  1.6]
    >>> ann.process_actual_input()
    >>> round_(ann.outputs)
    1.822222, 1.876983

    The next example shows how to solve the XOR problem with a two layer
    network.  As usual, `1` stands for `True` and `0` stands for `False`.

    We define a network with two inputs (`I1` and `I2`), two neurons in
    the first hidden layer (`H11` and `H12`), one neuron in the second
    hidden layer (`H2`), and a single output (`O1`):

    >>> ann.nmb_inputs = 2
    >>> ann.nmb_neurons = (2, 1)
    >>> ann.nmb_outputs = 1

    The value of `O1` shall be identical with the activation of `H2`:

    >>> ann.weights_output = 1.0
    >>> ann.intercepts_output = 0.0

    All intercepts of the neurons of the hidden layer are set to 750,
    so that an input of 500 results in an activation of approximately
    zero and an input of 1000 results in an activation of approximately
    one (note that matrix entries are not required should preferably be
    initialized with `nan` to avoid confusion):

    >>> ann.intercepts_hidden = [[-750.0, -750.0],
    ...                          [-750.0, nan]]

    The weighting factor between the both inputs and `H11` is 1000.
    Hence, one `True` input is sufficient to activate `H1`.  In contrast,
    the weighting factor between the both inputs and `H12` is 500 only.
    Hence, two `True` inputs are required to activate `H12`:

    >>> ann.weights_input= [[1000.0, 500.0],
    ...                     [1000.0, 500.0]]

    The weighting factor between `H11` and `H2` is 1000.  Hence, in
    principle, `H11` can activate `H2`.  However, the weighting factor
    between `H12` and `H2` is -1000.  Hence, `H12` is able to prevent
    `H2` from becoming activated even when `H11` is activated:

    >>> ann.weights_hidden= [[[1000.0, nan],
    ...                      [-1000.0, nan]]]

    To recapitulate, `H11` determines if at least one input is `True`,
    `H12` determines if both inputs are `True`, and `H2` determines
    if exactly one input is `True`, which is the solution for the XOR-problem:

    >>> ann
    ann(nmb_inputs=2,
        nmb_neurons=(2, 1),
        nmb_outputs=1,
        weights_input=[[1000.0, 500.0],
                       [1000.0, 500.0]],
        weights_hidden=[[[1000.0, nan],
                         [-1000.0, nan]]],
        weights_output=[[1.0]],
        intercepts_hidden=[[-750.0, -750.0],
                           [-750.0, nan]],
        intercepts_output=[0.0])

    The following calculation confirms that the network is properly
    configured:

    >>> for inputs in ((0.0, 0.0),
    ...                (1.0, 0.0),
    ...                (0.0, 1.0),
    ...                (1.0, 1.0)):
    ...    ann.inputs = inputs
    ...    ann.process_actual_input()
    ...    print(inputs[0], inputs[1], ann.outputs[0])
    0.0 0.0 0.0
    1.0 0.0 1.0
    0.0 1.0 1.0
    1.0 1.0 0.0

    To elaborate on the last calculation, the corresponding activations
    of the hidden neurons are shown. As both inputs are `True`, both
    `H12` (upper left value) and `H22` (upper right value) activated,
    but `H2` (lower left value) is not:

    >>> ann.neurons
    array([[ 1.,  1.],
           [ 0.,  0.]])

    The last defined configuration is used in some examples of the
    documentation of the members of class |anntools.ANN|:

    >>> from hydpy import dummies
    >>> dummies.ann = ann

    Note that Python class |anntools.ANN| handles a corresponding
    Cython extension class defined in |annutils|, which does not
    protect itself against segmentation faults. But class
    |anntools.ANN| takes up this task, meaning using its public
    members should always result in readable exceptions instead of
    program crashes, e.g.:

    >>> ANN().nmb_layers
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `nmb_layers` of object `ann` \
is not usable so far.
    """
    NDIM = 0
    TYPE = 'annutils.ANN'
    TIME = None
    SPAN = (None, None)

    parameterstep = parametertools.Parameter.__dict__['parameterstep']
    simulationstep = parametertools.Parameter.__dict__['simulationstep']

    def __init__(self):
        self.subpars = None
        self.fastaccess = objecttools.FastAccess()
        self._isready = exceptiontools.IsReady(
            false=('nmb_inputs',  'nmb_outputs', 'nmb_neurons'))
        self._cann = annutils.ANN()
        self._max_nmb_neurons = None

    def connect(self, subpars):
        """Connect the actual |anntools.ANN| object with the given
        |SubParameters| object."""
        self.subpars = subpars
        self.fastaccess = subpars.fastaccess
        setattr(self.fastaccess, self.name, self._cann)

    name = property(objecttools.name)

    def __call__(self, nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
                 weights_input=None, weights_output=None, weights_hidden=None,
                 intercepts_hidden=None, intercepts_output=None):
        self.nmb_inputs = nmb_inputs
        self.nmb_outputs = nmb_outputs
        self.nmb_neurons = nmb_neurons
        self.weights_input = weights_input
        self.weights_hidden = weights_hidden
        self.weights_output = weights_output
        self.intercepts_hidden = intercepts_hidden
        self.intercepts_output = intercepts_output
        del self.inputs
        del self.outputs
        del self.neurons

    def _update_shapes(self):
        if self._isready:
            del self.weights_input
            del self.weights_hidden
            del self.weights_output
            del self.intercepts_hidden
            del self.intercepts_output
            del self.inputs
            del self.outputs
            del self.neurons

    def _get_nmb_inputs(self):
        """Number of input nodes.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_inputs
        2
        """
        return self._cann.nmb_inputs

    def _set_nmb_inputs(self, value):
        self._cann.nmb_inputs = int(value)
        self._update_shapes()

    nmb_inputs = exceptiontools.protected_property(
        'nmb_inputs', _get_nmb_inputs, _set_nmb_inputs)

    def _get_nmb_outputs(self):
        """Number of output nodes.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_outputs
        1
        """
        return self._cann.nmb_outputs

    def _set_nmb_outputs(self, value):
        self._cann.nmb_outputs = int(value)
        self._update_shapes()

    nmb_outputs = exceptiontools.protected_property(
        'nmb_outputs', _get_nmb_outputs, _set_nmb_outputs)

    def _get_nmb_layers(self):
        """Number of hidden layers.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_layers
        2
        """
        return self._cann.nmb_layers

    nmb_layers = exceptiontools.dependent_property(
        'nmb_layers', _get_nmb_layers)

    def _get_nmb_neurons(self):
        """Number of neurons of the hidden layers.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_neurons
        (2, 1)
        """
        return tuple(numpy.asarray(self._cann.nmb_neurons))

    def _set_nmb_neurons(self, value):
        self._cann.nmb_neurons = numpy.array(value, dtype=int, ndmin=1)
        self._cann.nmb_layers = len(value)
        self._max_nmb_neurons = max(value)
        self._update_shapes()

    nmb_neurons = exceptiontools.protected_property(
        'nmb_neurons', _get_nmb_neurons, _set_nmb_neurons)

    def _get_weights_input(self):
        """Weights between all input nodes and neurons of the first hidden
        layer.

        The input nodes and the neurons are varied on the first axis and
        on the second axis of the 2-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_inputs=2, nmb_neurons=(3,))
        >>> ann.weights_input
        array([[ 0.,  0.,  0.],
               [ 0.,  0.,  0.]])

        It is allowed to set values via slicing:

        >>> ann.weights_input[:, 0] = 1.
        >>> ann.weights_input
        array([[ 1.,  0.,  0.],
               [ 1.,  0.,  0.]])

        If possible, type conversions are performed:

        >>> ann.weights_input = '2'
        >>> ann.weights_input
        array([[ 2.,  2.,  2.],
               [ 2.,  2.,  2.]])

        One can assign whole matrices directly:

        >>> import numpy
        >>> ann.weights_input = numpy.eye(2, 3)
        >>> ann.weights_input
        array([[ 1.,  0.,  0.],
        ...    [ 0.,  1.,  0.]])

        One can also delete the values contained in the array:

        >>> del ann.weights_input
        >>> ann.weights_input
        array([[ 0.,  0.,  0.],
        ...    [ 0.,  0.,  0.]])

        Errors like wrong shapes (or unconvertible inputs) result in error
        messages:

        >>> ann.weights_input = numpy.eye(3)
        Traceback (most recent call last):
        ...
        ValueError: While trying to set the input weights of the artificial \
neural network `ann` of element `?`, the following error occured: could not \
broadcast input array from shape (3,3) into shape (2,3)
        """
        return numpy.asarray(self._cann.weights_input)

    def _set_weights_input(self, values):
        if values is None:
            self._del_weights_input()
        else:
            try:
                self._cann.weights_input = numpy.full(self.shape_weights_input,
                                                      values, dtype=float)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to set the input weights of the artificial '
                    'neural network `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))

    def _del_weights_input(self):
        self._cann.weights_input = numpy.zeros(self.shape_weights_input)

    weights_input = exceptiontools.dependent_property(
        'weights_input', _get_weights_input,
        _set_weights_input, _del_weights_input)

    @property
    def shape_weights_input(self):
        """Shape of the array containing the input weights.

        >>> from hydpy import dummies
        >>> dummies.ann.shape_weights_input
        (2, 2)
        """
        return (self.nmb_inputs, self.nmb_neurons[0])

    @property
    def nmb_weights_input(self):
        """Number of input weights.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_weights_input
        4
        """
        return self.nmb_neurons[0]*self.nmb_inputs

    def _get_weights_output(self):
        """Weights between all neurons of the last hidden layer and the output
        nodes.

        The neurons and the output nodes are varied on the first axis and
        on the second axis of the 2-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_outputs=2, nmb_neurons=(3,))
        >>> ann.weights_output
        array([[ 0.,  0.],
               [ 0.,  0.],
               [ 0.,  0.]])

        It is allowed to set values via slicing:

        >>> ann.weights_output[:, 0] = 1.
        >>> ann.weights_output
        array([[ 1.,  0.],
               [ 1.,  0.],
               [ 1.,  0.]])

        If possible, type conversions are performed:

        >>> ann.weights_output = '2'
        >>> ann.weights_output
        array([[ 2.,  2.],
               [ 2.,  2.],
               [ 2.,  2.]])

        One can assign whole matrices directly:

        >>> import numpy
        >>> ann.weights_output = numpy.eye(3, 2)
        >>> ann.weights_output
        array([[ 1.,  0.],
               [ 0.,  1.],
               [ 0.,  0.]])

        One can also delete the values contained in the array:

        >>> del ann.weights_output
        >>> ann.weights_output
        array([[ 0.,  0.],
               [ 0.,  0.],
               [ 0.,  0.]])

        Errors like wrong shapes (or unconvertible inputs) result in error
        messages:

        >>> ann.weights_output = numpy.eye(3)
        Traceback (most recent call last):
        ...
        ValueError: While trying to set the output weights of the artificial \
neural network `ann` of element `?`, the following error occured: could not \
broadcast input array from shape (3,3) into shape (3,2)
        """
        return numpy.asarray(self._cann.weights_output)

    def _set_weights_output(self, values):
        if values is None:
            self._del_weights_output()
        else:
            try:
                self._cann.weights_output = numpy.full(
                    self.shape_weights_output, values, dtype=float)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to set the output weights of the artificial '
                    'neural network `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))

    def _del_weights_output(self):
        self._cann.weights_output = numpy.zeros(self.shape_weights_output)

    weights_output = exceptiontools.dependent_property(
        'weights_output',  _get_weights_output,
        _set_weights_output, _del_weights_output)

    @property
    def shape_weights_output(self):
        """Shape of the array containing the output weights.

        >>> from hydpy import dummies
        >>> dummies.ann.shape_weights_output
        (1, 1)
        """
        return (self.nmb_neurons[-1], self.nmb_outputs)

    @property
    def nmb_weights_output(self):
        """Number of output weights.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_weights_output
        1
        """
        return self.nmb_neurons[-1]*self.nmb_outputs

    def _get_weights_hidden(self):
        """Weights between between the neurons of the different hidden layers.

        The layers are varied on the first axis, the neurons of the respective
        upstream layer on the second axis and the neurons of the respective
        downstream layer on the third axis of a 3-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_neurons=(3, 2, 3))
        >>> ann.weights_hidden
        array([[[  0.,   0.,  nan],
                [  0.,   0.,  nan],
                [  0.,   0.,  nan]],
        <BLANKLINE>
               [[  0.,   0.,   0.],
                [  0.,   0.,   0.],
                [ nan,  nan,  nan]]])

        It is allowed to set values via slicing:

        >>> ann.weights_hidden[1, :, 0] = 1.
        >>> ann.weights_hidden
        array([[[  0.,   0.,  nan],
                [  0.,   0.,  nan],
                [  0.,   0.,  nan]],
        <BLANKLINE>
               [[  1.,   0.,   0.],
                [  1.,   0.,   0.],
                [  1.,  nan,  nan]]])

        If possible, type conversions are performed:

        >>> ann.weights_hidden = '2'
        >>> ann.weights_hidden
        array([[[ 2.,  2.,  2.],
                [ 2.,  2.,  2.],
                [ 2.,  2.,  2.]],
        <BLANKLINE>
               [[ 2.,  2.,  2.],
                [ 2.,  2.,  2.],
                [ 2.,  2.,  2.]]])

        One can assign whole matrices directly:

        >>> import numpy
        >>> ann.weights_hidden = numpy.eye(3)
        >>> ann.weights_hidden
        array([[[ 1.,  0.,  0.],
                [ 0.,  1.,  0.],
                [ 0.,  0.,  1.]],
        <BLANKLINE>
               [[ 1.,  0.,  0.],
                [ 0.,  1.,  0.],
                [ 0.,  0.,  1.]]])

        One can also delete the values contained in the array:

        >>> del ann.weights_hidden
        >>> ann.weights_hidden
        array([[[  0.,   0.,  nan],
                [  0.,   0.,  nan],
                [  0.,   0.,  nan]],
        <BLANKLINE>
               [[  0.,   0.,   0.],
                [  0.,   0.,   0.],
                [ nan,  nan,  nan]]])

        Errors like wrong shapes (or unconvertible inputs) result in error
        messages:

        >>> ann.weights_hidden = numpy.eye(3, 2)
        Traceback (most recent call last):
        ...
        ValueError: While trying to set the hidden weights of the artificial \
neural network `ann` of element `?`, the following error occured: could not \
broadcast input array from shape (3,2) into shape (2,3,3)
        """
        return numpy.asarray(self._cann.weights_hidden)

    def _set_weights_hidden(self, values):
        if values is None:
            self._del_weights_hidden()
        else:
            try:
                self._cann.weights_hidden = numpy.full(
                    self.shape_weights_hidden, values, dtype=float)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to set the hidden weights of the artificial '
                    'neural network `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))

    def _del_weights_hidden(self):
        self._cann.weights_hidden = numpy.full(self.shape_weights_hidden,
                                               numpy.nan)
        for idx_layer in range(self.nmb_layers-1):
            for idx_neuron1 in range(self.nmb_neurons[idx_layer]):
                for idx_neuron2 in range(self.nmb_neurons[idx_layer+1]):
                    self._cann.weights_hidden[idx_layer,
                                              idx_neuron1,
                                              idx_neuron2] = 0.

    weights_hidden = exceptiontools.dependent_property(
        'weights_hidden', _get_weights_hidden,
        _set_weights_hidden, _del_weights_hidden)

    @property
    def shape_weights_hidden(self):
        """Shape of the array containing the activation of the hidden neurons.

        >>> from hydpy import dummies
        >>> dummies.ann.shape_weights_hidden
        (1, 2, 2)
        """
        if self.nmb_layers > 1:
            return (self.nmb_layers-1,
                    self._max_nmb_neurons,
                    self._max_nmb_neurons)
        return (0, 0, 0)

    @property
    def nmb_weights_hidden(self):
        """Number of hidden weights.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_weights_hidden
        2
        """
        nmb = 0
        for idx_layer in range(self.nmb_layers-1):
            nmb += self.nmb_neurons[idx_layer] * self.nmb_neurons[idx_layer+1]
        return nmb

    def _get_intercepts_hidden(self):
        """Intercepts of all neurons of the hidden layers.

        All intercepts are handled in a 1-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_neurons=(3, 2))
        >>> ann.intercepts_hidden
        array([[  0.,   0.,   0.],
               [  0.,   0.,  nan]])

        It is allowed to set values via slicing:

        >>> ann.intercepts_hidden[0, :] = 1.
        >>> ann.intercepts_hidden
        array([[  1.,   1.,   1.],
               [  0.,   0.,  nan]])

        If possible, type conversions are performed:

        >>> ann.intercepts_hidden = '2'
        >>> ann.intercepts_hidden
        array([[ 2.,  2.,  2.],
               [ 2.,  2.,  2.]])

        One can assign whole matrices directly:

        >>> import numpy
        >>> ann.intercepts_hidden = [1.0, 3.0, 2.0]
        >>> ann.intercepts_hidden
        array([[ 1.,  3.,  2.],
               [ 1.,  3.,  2.]])

        One can also delete the values contained in the array:

        >>> del ann.intercepts_hidden
        >>> ann.intercepts_hidden
        array([[  0.,   0.,   0.],
               [  0.,   0.,  nan]])

        Errors like wrong shapes (or unconvertible inputs) result in error
        messages:

        >>> ann.intercepts_hidden = [1.0, 3.0]
        Traceback (most recent call last):
        ...
        ValueError: While trying to set the neuron related intercepts of the \
artificial neural network `ann` of element `?`, the following error occured: \
could not broadcast input array from shape (2) into shape (2,3)

        The number of input intercepts is available as a property:

        >>> ann.nmb_intercepts_hidden
        5
        """
        return numpy.asarray(self._cann.intercepts_hidden)

    def _set_intercepts_hidden(self, values):
        if values is None:
            self._del_intercepts_hidden()
        else:
            try:
                self._cann.intercepts_hidden = numpy.full(
                    self.shape_intercepts_hidden, values, dtype=float)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to set the neuron related intercepts of '
                    'the artificial neural network `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))

    def _del_intercepts_hidden(self):
        self._cann.intercepts_hidden = numpy.full(
            self.shape_intercepts_hidden,
            numpy.nan)
        for idx_layer in range(self.nmb_layers):
            for idx_neuron in range(self.nmb_neurons[idx_layer]):
                self._cann.intercepts_hidden[idx_layer, idx_neuron] = 0.

    intercepts_hidden = exceptiontools.dependent_property(
        'intercepts_hidden', _get_intercepts_hidden,
        _set_intercepts_hidden, _del_intercepts_hidden)

    @property
    def shape_intercepts_hidden(self):
        """Shape if the array containing the intercepts of neurons of
        the hidden layers."""
        return (self.nmb_layers, self._max_nmb_neurons)

    @property
    def nmb_intercepts_hidden(self):
        """Number of input intercepts."""
        return sum(self.nmb_neurons)

    def _get_intercepts_output(self):
        """Intercepts of all output nodes.

        All intercepts are handled in a 1-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_outputs=3)
        >>> ann.intercepts_output
        array([ 0.,  0.,  0.])

        It is allowed to set values via slicing:

        >>> ann.intercepts_output[1:] = 1.
        >>> ann.intercepts_output
        array([ 0.,  1.,  1.])

        If possible, type conversions are performed:

        >>> ann.intercepts_output = '2'
        >>> ann.intercepts_output
        array([ 2.,  2.,  2.])

        One can assign whole matrices directly:

        >>> import numpy
        >>> ann.intercepts_output = [1.0, 3.0, 2.0]
        >>> ann.intercepts_output
        array([ 1.,  3.,  2.])

        One can also delete the values contained in the array:

        >>> del ann.intercepts_output
        >>> ann.intercepts_output
        array([ 0.,  0.,  0.])

        Errors like wrong shapes (or unconvertible inputs) result in error
        messages:

        >>> ann.intercepts_output = [1.0, 3.0]
        Traceback (most recent call last):
        ...
        ValueError: While trying to set the output node related intercepts \
of the artificial neural network `ann` of element `?`, the following error \
occured: could not broadcast input array from shape (2) into shape (3)
        """
        return numpy.asarray(self._cann.intercepts_output)

    def _set_intercepts_output(self, values):
        if values is None:
            self._del_intercepts_output()
        else:
            try:
                self._cann.intercepts_output = numpy.full(
                    self.shape_intercepts_output, values, dtype=float)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to set the output node related intercepts '
                    'of the artificial neural network `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))

    def _del_intercepts_output(self):
        self._cann.intercepts_output = numpy.zeros(
            self.shape_intercepts_output)

    intercepts_output = exceptiontools.dependent_property(
        'intercepts_output', _get_intercepts_output,
        _set_intercepts_output, _del_intercepts_output)

    @property
    def shape_intercepts_output(self):
        """Shape if the array containing the intercepts of neurons of
        the hidden layers.

        >>> from hydpy import dummies
        >>> dummies.ann.shape_intercepts_output
        (1,)
        """
        return (self.nmb_outputs,)

    @property
    def nmb_intercepts_output(self):
        """Number of output intercepts.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_intercepts_output
        1
        """
        return self.nmb_outputs

    def _get_inputs(self):
        """Values of the input nodes.

        All input values are handled in a 1-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_inputs=3)
        >>> ann.inputs
        array([ 0.,  0.,  0.])

        It is allowed to set values via slicing:

        >>> ann.inputs[1:] = 1.
        >>> ann.inputs
        array([ 0.,  1.,  1.])

        If possible, type conversions are performed:

        >>> ann.inputs = '2'
        >>> ann.inputs
        array([ 2.,  2.,  2.])

        One can assign whole matrices directly:

        >>> import numpy
        >>> ann.inputs = [1.0, 3.0, 2.0]
        >>> ann.inputs
        array([ 1.,  3.,  2.])

        One can also delete the values contained in the array:

        >>> del ann.inputs
        >>> ann.inputs
        array([ 0.,  0.,  0.])

        Errors like wrong shapes (or unconvertible inputs) result in error
        messages:

        >>> ann.inputs = [1.0, 3.0]
        Traceback (most recent call last):
        ...
        ValueError: While trying to set the inputs of the artificial neural \
network `ann` of element `?`, the following error occured: could not \
broadcast input array from shape (2) into shape (3)
        """
        return numpy.asarray(self._cann.inputs)

    def _set_inputs(self, values):
        try:
            self._cann.inputs = numpy.full(self.nmb_inputs,
                                           values, dtype=float)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to set the inputs of the artificial '
                'neural network `%s` of element `%s`'
                % (self.name, objecttools.devicename(self)))

    def _del_inputs(self):
        self._cann.inputs = numpy.zeros(self.nmb_inputs)

    inputs = exceptiontools.dependent_property(
        'inputs', _get_inputs, _set_inputs, _del_inputs)

    def _get_outputs(self):
        """Values of the output nodes.

        All output values are handled in a 1-dimensional array:

        >>> from hydpy import ANN
        >>> ann = ANN()
        >>> ann(nmb_outputs=3)
        >>> ann.outputs
        array([ 0.,  0.,  0.])

        It is not allowed to change output values manually:

        >>> ann.outputs = 1.0
        Traceback (most recent call last):
        ...
        AttributeError: Attribute `outputs` of object `ann` \
cannot be used this way.
        """
        return numpy.asarray(self._cann.outputs)

    def _del_outputs(self):
        self._cann.outputs = numpy.zeros(self.nmb_outputs)

    outputs = exceptiontools.dependent_property(
        'outputs', _get_outputs, fdel=_del_outputs)

    def _get_neurons(self):
        """The activation of the neurons of the hidden layers.

        >>> from hydpy import dummies
        >>> dummies.ann.neurons
        array([[ 1.,  1.],
               [ 0.,  0.]])
        """
        return numpy.array(self._cann.neurons)

    def _del_neurons(self):
        nmb_neurons = numpy.asarray(self._cann.nmb_neurons)
        self._cann.neurons = numpy.zeros((self.nmb_layers, max(nmb_neurons)))

    neurons = exceptiontools.dependent_property(
        'neurons', _get_neurons, fdel=_del_neurons)

    def process_actual_input(self):
        """Calculates the network output values based on the input values
        defined previously.

        For more information see the documentation on class |anntools.ANN|.
        """
        self._cann.process_actual_input()

    @property
    def nmb_weights(self):
        """Number of all input, inner, and output weights.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_weights
        7
        """
        return (self.nmb_weights_input +
                self.nmb_weights_hidden +
                self.nmb_weights_output)

    @property
    def nmb_intercepts(self):
        """Number of all inner and output intercepts.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_intercepts
        4
        """
        return self.nmb_intercepts_hidden + self.nmb_intercepts_output

    @property
    def nmb_parameters(self):
        """Sum of |anntools.ANN.nmb_weights| and |anntools.ANN.nmb_intercepts|.

        >>> from hydpy import dummies
        >>> dummies.ann.nmb_parameters
        11
        """
        return self.nmb_weights + self.nmb_intercepts

    def verify(self):
        """Raise a |RuntimeError| if the network's shape is not defined
        completely.


        >>> from hydpy import dummies
        >>> dummies.ann.verify()

        >>> from hydpy import ANN
        >>> ANN().verify()
        Traceback (most recent call last):
        ...
        RuntimeError: The shape of the the artificial neural network \
parameter `ann` of element `?` has not been defined so far.
        """
        if not self._isready:
            raise RuntimeError(
                'The shape of the the artificial neural network '
                'parameter `%s`%shas not been defined so far.'
                % (self.name, objecttools.elementphrase(self)))

    def assignrepr(self, prefix):
        """Return a string representation of the actual |anntools.ANN| object
        that is prefixed with the given string."""
        prefix = '%s%s(' % (prefix, self.name)
        blanks = len(prefix)*' '
        lines = [(objecttools.assignrepr_value(
            self.nmb_inputs, '%snmb_inputs=' % prefix)+',')]
        lines.append(objecttools.assignrepr_tuple(
            self.nmb_neurons, '%snmb_neurons=' % blanks)+',')
        lines.append(objecttools.assignrepr_value(
            self.nmb_outputs, '%snmb_outputs=' % blanks)+',')
        lines.append(objecttools.assignrepr_list2(
            self.weights_input, '%sweights_input=' % blanks)+',')
        if self.nmb_layers > 1:
            lines.append(objecttools.assignrepr_list3(
                self.weights_hidden, '%sweights_hidden=' % blanks)+',')
        lines.append(objecttools.assignrepr_list2(
            self.weights_output, '%sweights_output=' % blanks)+',')
        lines.append(objecttools.assignrepr_list2(
            self.intercepts_hidden, '%sintercepts_hidden=' % blanks)+',')
        lines.append(objecttools.assignrepr_list(
            self.intercepts_output, '%sintercepts_output=' % blanks)+')')
        return '\n'.join(lines)

    def __repr__(self):
        return self.assignrepr(prefix='')

    def plot(self, xmin, xmax, idx_input=0, idx_output=0, points=100,
             **kwargs):
        """Plot the relationship between a certain input (`idx_input`) and a
        certain output (`idx_output`) variable described by the actual
        |anntools.ANN| object.

        Define the lower and the upper bound of the x axis via arguments
        `xmin` and `xmax`.  The number of plotting points can be modified
        by argument `points`.  Additional `matplotlib` plotting arguments
        can be passed as keyword arguments.
        """
        xs_ = numpy.linspace(xmin, xmax, points)
        ys_ = numpy.zeros(xs_.shape)
        for idx, x__ in enumerate(xs_):
            self.inputs[idx_input] = x__
            self.process_actual_input()
            ys_[idx] = self.outputs[idx_output]
        pyplot.plot(xs_, ys_, **kwargs)


abctools.ParameterABC.register(ANN)
abctools.ANNABC.register(ANN)


def ann(**kwargs):
    """Return a new stand alone |anntools.ANN| object with the given parameter
    values.

    The purpose of this function is to allow for string representations of
    parameters containing multiple |anntools.ANN| instances.

    When passing no arguments, the default values of class |anntools.ANN| will
    be applied:

    >>> from hydpy import ANN
    >>> ann1 = ann()
    >>> ann1
    ann(nmb_inputs=1,
        nmb_neurons=(1,),
        nmb_outputs=1,
        weights_input=[[0.0]],
        weights_output=[[0.0]],
        intercepts_hidden=[[0.0]],
        intercepts_output=[0.0])

    Of course, all parameter values can be changed:

    >>> ann2 = ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...            weights_input=4.0, weights_output=3.0,
    ...            intercepts_hidden=-16.0, intercepts_output=-1.0)
    >>> ann2
    ann(nmb_inputs=1,
        nmb_neurons=(1,),
        nmb_outputs=1,
        weights_input=[[4.0]],
        weights_output=[[3.0]],
        intercepts_hidden=[[-16.0]],
        intercepts_output=[-1.0])

    The following line is just thought to make clear, that two independent
    |anntools.ANN| objects have been initialized (instead of changing the
    values of an existing |anntools.ANN| object vai its `call` method):

    >>> ann1 is ann2
    False
    """
    new_ann = ANN()
    new_ann(**kwargs)
    return new_ann


class SeasonalANN(object):
    """Handles relationships described by artificial neural networks that
    vary within an anual cycle.

    Class |anntools.SeasonalANN| is an alternative implementation of class
    |SeasonalParameter| specifically designed for handling multiple
    |anntools.ANN| objects that are valid for different times of the year,
    described by |TOY| objects.  The total output of a |anntools.SeasonalANN|
    object is a weighted mean of the output of one or two "normal" neural
    networks.  |anntools.SeasonalANN.ratios| used for weighting depend
    on the actual time of the year.

    To explain this in more detail, let us define a |anntools.SeasonalANN|
    object first, that contains three "normal" networks for January, 1,
    March, 1, and July, 1, respectively (note that this example is similar
    to the example used to describe class
    |SeasonalParameter|):

    >>> from hydpy import SeasonalANN, ann
    >>> seasonalann = SeasonalANN()
    >>> seasonalann.simulationstep = '1d'
    >>> seasonalann(
    ...     _1_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=0.0, weights_output=0.0,
    ...                 intercepts_hidden=0.0, intercepts_output=1.0),
    ...     _7_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=4.0, weights_output=3.0,
    ...                 intercepts_hidden=-16.0, intercepts_output=-1.0),
    ...     _3_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=0.0, weights_output=0.0,
    ...                 intercepts_hidden=0.0, intercepts_output=-1.0))

    The confused time order in the initialization call above does not pose
    a problem, as |anntools.SeasonalANN| performs time sorting internally:

    >>> seasonalann
    seasonalann(toy_1_1_12_0_0=ann(nmb_inputs=1,
                                   nmb_neurons=(1,),
                                   nmb_outputs=1,
                                   weights_input=[[0.0]],
                                   weights_output=[[0.0]],
                                   intercepts_hidden=[[0.0]],
                                   intercepts_output=[1.0]),
                toy_3_1_12_0_0=ann(nmb_inputs=1,
                                   nmb_neurons=(1,),
                                   nmb_outputs=1,
                                   weights_input=[[0.0]],
                                   weights_output=[[0.0]],
                                   intercepts_hidden=[[0.0]],
                                   intercepts_output=[-1.0]),
                toy_7_1_12_0_0=ann(nmb_inputs=1,
                                   nmb_neurons=(1,),
                                   nmb_outputs=1,
                                   weights_input=[[4.0]],
                                   weights_output=[[3.0]],
                                   intercepts_hidden=[[-16.0]],
                                   intercepts_output=[-1.0]))

    The property |anntools.SeasonalANN.shape| does reflect the number of
    required weighting ratios for each time of year (in this example:
    366 days per year) and each neural network (in this example: three):

    >>> seasonalann.shape
    (366, 3)

    For safety reasons, |anntools.SeasonalANN.shape| should normally not
    be changed manually:

    >>> seasonalann.shape = (366, 4)
    Traceback (most recent call last):
    ...
    AttributeError: can't set attribute

    The following interactive shows how the |anntools.SeasonalANN.ratios|
    used for weighting are calculated:

    .. testsetup::

        >>> from bokeh import plotting, models, palettes
        ...
        >>> from hydpy import docs
        >>> import os
        >>> plotting.output_file(os.path.join(
        ...     docs.__path__[0], 'html', 'anntools.SeasonalANN.ratios.html'))
        >>> hover = models.HoverTool(tooltips=[
        ...     ("(x,y)", "($x, $y)")])
        >>> plot = plotting.figure(toolbar_location="above",
        ...                        plot_width=500, plot_height=300)
        >>> plot.tools.append(hover)
        >>> legend_entries = []
        >>> for idx, (toy, color) in enumerate(
        ...         zip(seasonalann.toys, palettes.Dark2_5)):
        ...     line = plot.line(range(366), seasonalann.ratios[:, idx],
        ...                      alpha=0.8, muted_alpha=0.2, color=color)
        ...     line.muted = True
        ...     legend_entries.append((str(toy), [line]))
        >>> legend = models.Legend(items=legend_entries,
        ...                        location=(10, 0),
        ...                        click_policy='mute')
        >>> plot.add_layout(legend, 'right')
        >>> label_dict = {0: 'Jan 1',
        ...               60: 'Mar 1',
        ...               182: 'Jul 1'}
        >>> plot.xaxis.ticker =  sorted(label_dict.keys())
        >>> plot.xaxis.formatter = models.FuncTickFormatter(
        ...     code='var labels = %s; return labels[tick];' % label_dict)
        >>> dummy = plotting.save(plot)

    .. raw:: html

        <iframe
            src="anntools.SeasonalANN.ratios.html"
            width="100%"
            height="300px"
            frameborder=0
        ></iframe>

    For example, on July, 1 (which is the 183th day of a leap year),
    only the output of the third network is relevant:

    >>> from hydpy import print_values
    >>> print_values(seasonalann.ratios[182])
    0.0, 0.0, 1.0

    On Juni, 30, and July, 2, also the second and the first neural network
    are relevant, respectively:

    >>> print_values(seasonalann.ratios[181])
    0.0, 0.008197, 0.991803
    >>> print_values(seasonalann.ratios[183])
    0.005435, 0.0, 0.994565

    Inserting data, processing this data, and fetching the output works
    as explained for class |anntools.ANN|, except that the index of the
    actual time of year needs to be passed as the single argument of
    |anntools.SeasonalANN.process_actual_input|.  Passing the index value
    `182` activates the third network only, which is configured exactly
    as the one exemplifying class |anntools.ANN|:

    >>> from hydpy import round_
    >>> for input_ in range(9):
    ...     seasonalann.inputs[0] = input_
    ...     seasonalann.process_actual_input(182)
    ...     round_([input_, seasonalann.outputs[0]])
    0, -1.0
    1, -0.999982
    2, -0.998994
    3, -0.946041
    4, 0.5
    5, 1.946041
    6, 1.998994
    7, 1.999982
    8, 2.0

    To see that the final output values are actually the weighted mean
    of the output values of the single neural networks, we repeat the
    above example for January, 13, where the first and the second neural
    network have ratios of 0.8 and 0.2 respectively:

    >>> print_values(seasonalann.ratios[12])
    0.8, 0.2, 0.0

    For both networks all parameters except the output intercepts are
    zero.  Hence, the calculated output is independent of the given input.
    The output of the first network (1.0) dominates the output of the
    second network (-1.0):

    >>> from hydpy import round_
    >>> for input_ in range(9):
    ...     seasonalann.inputs[0] = input_
    ...     seasonalann.process_actual_input(12)
    ...     round_([input_, seasonalann.outputs[0]])
    0, 0.6
    1, 0.6
    2, 0.6
    3, 0.6
    4, 0.6
    5, 0.6
    6, 0.6
    7, 0.6
    8, 0.6

    It is of great importance that all contained neural networks are
    consistent.  Hence some tests are performed:

    >>> seasonalann = SeasonalANN()
    >>> seasonalann.process_actual_input(0)
    Traceback (most recent call last):
    ...
    RuntimeError: The seasonal neural network collection `seasonalann` \
of element `?` has not been properly prepared so far.

    >>> seasonalann(1)
    Traceback (most recent call last):
    ...
    TypeError: Type `int` is not (a subclass of) type `ANN`.

    >>> seasonalann(
    ...     _13_1_12=ann(nmb_inputs=2, nmb_neurons=(1,), nmb_outputs=1,
    ...                  weights_input=0.0, weights_output=0.0,
    ...                  intercepts_hidden=0.0, intercepts_output=1.0))
    Traceback (most recent call last):
    ...
    ValueError: While trying to add a season specific neural network to \
parameter `seasonalann` of element `?`, the following error occured: \
While trying to retrieve the month for TOY (time of year) object based \
on the string `_13_1_12`, the following error occured: \
The value of property `month` of TOY (time of year) objects must lie \
within the range `(1, 12)`, but the given value is `13`.

    >>> seasonalann(
    ...     ann(nmb_inputs=2, nmb_neurons=(1,), nmb_outputs=1,
    ...         weights_input=0.0, weights_output=0.0,
    ...         intercepts_hidden=0.0, intercepts_output=1.0))
    >>> seasonalann
    seasonalann(ann(nmb_inputs=2,
                    nmb_neurons=(1,),
                    nmb_outputs=1,
                    weights_input=[[0.0],
                                   [0.0]],
                    weights_output=[[0.0]],
                    intercepts_hidden=[[0.0]],
                    intercepts_output=[1.0]))

    >>> seasonalann(
    ...     ann(nmb_inputs=2, nmb_neurons=(1,), nmb_outputs=1,
    ...         weights_input=0.0, weights_output=0.0,
    ...         intercepts_hidden=0.0, intercepts_output=1.0),
    ...     _7_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=4.0, weights_output=3.0,
    ...                 intercepts_hidden=-16.0, intercepts_output=-1.0),
    ...     _3_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=0.0, weights_output=0.0,
    ...                 intercepts_hidden=0.0, intercepts_output=-1.0))
    Traceback (most recent call last):
    ...
    ValueError: Type `SeasonalANN` accepts either a single positional \
argument or an arbitrary number of keyword arguments, but for the \
corresponding parameter of element `?` 1 positional and 2 keyword \
arguments have been given.

    >>> seasonalann(
    ...     _1_1_12=ann(nmb_inputs=2, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=0.0, weights_output=0.0,
    ...                 intercepts_hidden=0.0, intercepts_output=1.0),
    ...     _7_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=4.0, weights_output=3.0,
    ...                 intercepts_hidden=-16.0, intercepts_output=-1.0),
    ...     _3_1_12=ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...                 weights_input=0.0, weights_output=0.0,
    ...                 intercepts_hidden=0.0, intercepts_output=-1.0))
    Traceback (most recent call last):
    ...
    RuntimeError: The number of input and output values of all neural \
networks contained by a seasonal neural network collection must be \
identical and be known by the containing object.  But the seasonal \
neural network collection `seasonalann` of element `?` assumes `2` input \
and `1` output values, while the network corresponding to the time of \
year `toy_3_1_12_0_0` requires `1` input and `1` output values.

    Whenever a test fails, all networks are removed for safety:

    >>> seasonalann
    seasonalann()

    Alternatively, neural networks can be added individually via
    attribute access:

    >>> jan = ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
    ...           weights_input=0.0, weights_output=0.0,
    ...           intercepts_hidden=0.0, intercepts_output=1.0)
    >>> seasonalann.toy_1_1_12 = jan

    Setting an attribute updates everything, e.g.:

    >>> round_(seasonalann.ratios[0])
    1.0

    The mentioned safety checks do also apply when adding networks
    via attribute access, e.g.:

    >>> seasonalann.toy_7_1_12 = ann(nmb_inputs=2,
    ...                              nmb_neurons=(1,),
    ...                              nmb_outputs=1,
    ...                              weights_input=0.0,
    ...                              weights_output=0.0,
    ...                              intercepts_hidden=0.0,
    ...                              intercepts_output=1.0)
    Traceback (most recent call last):
    ...
    RuntimeError: While trying to assign a new neural network to the \
seasonal neural network collection `seasonalann` of element `?` based \
on name `toy_7_1_12`, the following error occured: \
The number of input and output values of all neural networks contained \
by a seasonal neural network collection must be identical and be known \
by the containing object.  But the seasonal neural network collection \
`seasonalann` of element `?` assumes `1` input and `1` output values, \
while the network corresponding to the time of year `toy_7_1_12_0_0` \
requires `2` input and `1` output values.

    Besides setting new networks, getting and deleting them are also
    suppported:

    >>> seasonalann.toy_1_1_12 = jan
    >>> seasonalann.toy_1_1_12
    ann(nmb_inputs=1,
        nmb_neurons=(1,),
        nmb_outputs=1,
        weights_input=[[0.0]],
        weights_output=[[0.0]],
        intercepts_hidden=[[0.0]],
        intercepts_output=[1.0])
    >>> del seasonalann.toy_1_1_12

    These error messages related to attribute access are provided:

    >>> seasonalann.toy_1_1_12
    Traceback (most recent call last):
    ...
    AttributeError: While trying to look up for a neural network handled \
by the seasonal neural network collection `seasonalann` of element `?` \
based on name `toy_1_1_12`, the following error occured: No neural network \
is registered under a TOY object named `toy_1_1_12_0_0`.

    >>> del seasonalann.toy_1_1_12
    Traceback (most recent call last):
    ...
    AttributeError: While trying to remove a new neural network from the \
seasonal neural network collection `seasonalann` of element `?` based on \
name `toy_1_1_12`, the following error occured: No neural network is \
registered under a TOY object named `toy_1_1_12_0_0`.

    >>> seasonalann.toy_1_1_12 = 1
    Traceback (most recent call last):
    ...
    TypeError: While trying to assign a new neural network to the seasonal \
neural network collection `seasonalann` of element `?` based on name \
`toy_1_1_12`, the following error occured: Value `1` of type `int` has \
been given, but a value of type `ANN` is required.

    Setting and deleting "normal" attributes is supported:

    >>> seasonalann.temp = 999
    >>> seasonalann.temp
    999
    >>> del seasonalann.temp
    >>> seasonalann.temp
    Traceback (most recent call last):
    ...
    AttributeError: 'SeasonalANN' object has no attribute 'temp'
    """
    NDIM = 0
    TYPE = 'annutils.SeasonalANN'
    TIME = None
    SPAN = (None, None)

    parameterstep = parametertools.Parameter.__dict__['parameterstep']
    simulationstep = parametertools.Parameter.__dict__['simulationstep']

    def __init__(self):
        self.subpars = None
        self.fastaccess = objecttools.FastAccess()
        self._toy2ann = {}
        self.__sann = None
        self._do_refresh = True

    def connect(self, subpars):
        """Connect the actual |anntools.SeasonalANN| object with the given
        |SubParameters| object."""
        self.subpars = subpars
        self.fastaccess = subpars.fastaccess

    name = property(objecttools.name)

    def __call__(self, *args, **kwargs):
        self._toy2ann.clear()
        self._do_refresh = False
        try:
            if (len(args) > 1) or (args and kwargs):
                raise ValueError(
                    'Type `%s` accepts either a single positional argument or '
                    'an arbitrary number of keyword arguments, but for the '
                    'corresponding parameter of element `%s` %d positional '
                    'and %d keyword arguments have been given.'
                    % (objecttools.classname(self),
                       objecttools.devicename(self),
                       len(args), len(kwargs)))
            if args:
                kwargs['_1'] = args[0]
            for (toystr, value) in kwargs.items():
                if not isinstance(value, abctools.ANNABC):
                    raise TypeError(
                        'Type `%s` is not (a subclass of) type `ANN`.'
                        % objecttools.classname(value))
                try:
                    setattr(self, str(timetools.TOY(toystr)), value)
                except BaseException:
                    objecttools.augment_excmessage(
                        'While trying to add a season specific neural '
                        'network to parameter `%s` of element `%s`'
                        % (self.name, objecttools.devicename(self)))
        except BaseException as exc:
            self._toy2ann.clear()
            raise exc
        finally:
            self._do_refresh = True
            self.refresh()

    def refresh(self):
        """Prepare the actual |anntools.SeasonalANN| object for calculations.

        Dispite all automated refreshings explained in the general
        documentation on class |anntools.SeasonalANN|, it is still possible
        to destroy the inner consistency of a |anntools.SeasonalANN| instance,
        as it stores its |anntools.ANN| objects by reference.  This is shown
        by the following example:

        >>> from hydpy import SeasonalANN, ann
        >>> seasonalann = SeasonalANN()
        >>> seasonalann.simulationstep = '1d'
        >>> jan = ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
        ...           weights_input=0.0, weights_output=0.0,
        ...           intercepts_hidden=0.0, intercepts_output=1.0)
        >>> seasonalann(_1_1_12=jan)
        >>> jan.nmb_inputs, jan.nmb_outputs = 2, 3
        >>> jan.nmb_inputs, jan.nmb_outputs
        (2, 3)
        >>> seasonalann.nmb_inputs, seasonalann.nmb_outputs
        (1, 1)

        Due to the C level implementation of the mathematical core of
        both |anntools.ANN| and |anntools.SeasonalANN| in module |annutils|,
        such an inconsistency might result in a program crash without any
        informative error message.  Whenever you are afraid some
        inconsistency might have crept in, and you want to repair it,
        call method |anntools.SeasonalANN.refresh| explicitly:

        >>> seasonalann.refresh()
        >>> jan.nmb_inputs, jan.nmb_outputs
        (2, 3)
        >>> seasonalann.nmb_inputs, seasonalann.nmb_outputs
        (2, 3)
        """
        if self._do_refresh:
            if self.anns:
                self.__sann = annutils.SeasonalANN(self.anns)
                setattr(self.fastaccess, self.name, self._sann)
                self._setshape((None, self._sann.nmb_anns))
                if self._sann.nmb_anns > 1:
                    self._interp()
                else:
                    self._sann.ratios[:, 0] = 1.
                self.verify()
            else:
                self.__sann = None

    def verify(self):
        """Raise a |RuntimeError| and removes all handled neural networks,
        if the they are defined inconsistently.

        Dispite all automated safety checks explained in the general
        documentation on class |anntools.SeasonalANN|, it is still possible
        to destroy the inner consistency of a |anntools.SeasonalANN| instance,
        as it stores its |anntools.ANN| objects by reference.  This is shown
        by the following example:

        >>> from hydpy import SeasonalANN, ann
        >>> seasonalann = SeasonalANN()
        >>> seasonalann.simulationstep = '1d'
        >>> jan = ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
        ...           weights_input=0.0, weights_output=0.0,
        ...           intercepts_hidden=0.0, intercepts_output=1.0)
        >>> seasonalann(_1_1_12=jan)
        >>> jan.nmb_inputs, jan.nmb_outputs = 2, 3
        >>> jan.nmb_inputs, jan.nmb_outputs
        (2, 3)
        >>> seasonalann.nmb_inputs, seasonalann.nmb_outputs
        (1, 1)

        Due to the C level implementation of the mathematical core of both
        |anntools.ANN| and |anntools.SeasonalANN| in module |annutils|,
        such an inconsistency might result in a program crash without any
        informative error message.  Whenever you are afraid some
        inconsistency might have crept in, and you want to find out if this
        is actually the case, call method |anntools.SeasonalANN.verify|
        explicitly:

        >>> seasonalann.verify()
        Traceback (most recent call last):
        ...
        RuntimeError: The number of input and output values of all neural \
networks contained by a seasonal neural network collection must be \
identical and be known by the containing object.  But the seasonal \
neural network collection `seasonalann` of element `?` assumes `1` input \
and `1` output values, while the network corresponding to the time of \
year `toy_1_1_12_0_0` requires `2` input and `3` output values.

        >>> seasonalann
        seasonalann()

        >>> seasonalann.verify()
        Traceback (most recent call last):
        ...
        RuntimeError: Seasonal artificial neural network collections need \
to handle at least one "normal" single neural network, but for the seasonal \
neural network `seasonalann` of element `?` none has been defined so far.

        """
        if not self.anns:
            self._toy2ann.clear()
            raise RuntimeError(
                'Seasonal artificial neural network collections need '
                'to handle at least one "normal" single neural network, '
                'but for the seasonal neural network `%s` of element '
                '`%s` none has been defined so far.'
                % (self.name, objecttools.devicename(self)))
        for toy, ann_ in self:
            ann_.verify()
            if ((self.nmb_inputs != ann_.nmb_inputs) or
                    (self.nmb_outputs != ann_.nmb_outputs)):
                self._toy2ann.clear()
                raise RuntimeError(
                    'The number of input and output values of all neural '
                    'networks contained by a seasonal neural network '
                    'collection must be identical and be known by the '
                    'containing object.  But the seasonal neural '
                    'network collection `%s` of element `%s` assumes '
                    '`%d` input and `%d` output values, while the network '
                    'corresponding to the time of year `%s` requires '
                    '`%d` input and `%d` output values.'
                    % (self.name, objecttools.devicename(self),
                       self.nmb_inputs, self.nmb_outputs,
                       toy,
                       ann_.nmb_inputs, ann_.nmb_outputs))

    def _interp(self):
        ratios = self.ratios
        ratios[:, :] = 0.0
        toys = self.toys
        timegrid = timetools.Timegrid(
            timetools.TOY._STARTDATE+self.simulationstep/2,
            timetools.TOY._ENDDATE+self.simulationstep/2,
            self.simulationstep)
        for tdx, date in enumerate(timegrid):
            xnew = timetools.TOY(date)
            for idx_1, x_1 in enumerate(toys):
                if x_1 > xnew:
                    idx_0 = idx_1-1
                    x_0 = toys[idx_0]
                    break
            else:
                idx_0 = -1
                idx_1 = 0
                x_0 = toys[idx_0]
                x_1 = toys[idx_1]
            ratios[tdx, idx_1] = (xnew-x_0)/(x_1-x_0)
            ratios[tdx, idx_0] = 1.-ratios[tdx, idx_1]

    def _getshape(self):
        return tuple(int(sub) for sub in self.ratios.shape)

    def _setshape(self, shape):
        try:
            shape = (int(shape),)
        except TypeError:
            pass
        shp = list(shape)
        shp[0] = timetools.Period('366d')/self.simulationstep
        shp[0] = int(numpy.ceil(round(shp[0], 10)))
        getattr(self.fastaccess, self.name).ratios = numpy.zeros(
            shp, dtype=float)

    shape = property(
        _getshape,
        doc='The shape of array |anntools.SeasonalANN.ratios|.')

    @property
    def toys(self):
        """A sorted |tuple| of all contained |TOY| objects."""
        return tuple(toy for (toy, ann) in self)

    @property
    def anns(self):
        """A sorted |tuple| of all contained |anntools.ANN| objects."""
        return tuple(ann for (toy, ann) in self)

    @property
    def ratios(self):
        """Ratios for weighting the single neural network outputs."""
        return numpy.asarray(self._sann.ratios)

    @property
    def _sann(self):
        sann = self.__sann
        if sann:
            return sann
        else:
            raise RuntimeError(
                'The seasonal neural network collection `%s` of '
                'element `%s` has not been properly prepared so far.'
                % (self.name, objecttools.devicename(self)))

    @property
    def nmb_inputs(self):
        """Number of input values of all neural networks."""
        return self._sann.nmb_inputs

    @property
    def inputs(self):
        """General input data for all neural networks."""
        return numpy.asarray(self._sann.inputs)

    @property
    def nmb_outputs(self):
        """Number of output values of all neural networks."""
        return self._sann.nmb_outputs

    @property
    def outputs(self):
        """Weighted output of the individual neural networks."""
        return numpy.asarray(self._sann.outputs)

    def process_actual_input(self, idx_toy):
        """Calculate the network output values based on the input values
        defined previously for the given index referencing the actual
        time of year.
        """
        self._sann.process_actual_input(idx_toy)

    def plot(self, xmin, xmax, idx_input=0, idx_output=0, points=100,
             **kwargs):
        """Call method |ANN.plot| of all |anntools.ANN| objects
        handled bythe actual |anntools.SeasonalANN| object.
        """
        for toy, ann in self:
            ann.plot(xmin, xmax,
                     idx_input=idx_input, idx_output=idx_output,
                     points=points,
                     label=str(toy))
        pyplot.legend()

    def __getattribute__(self, name):
        if name.startswith('toy_'):
            try:
                try:
                    return self._toy2ann[timetools.TOY(name)]
                except KeyError:
                    raise AttributeError(
                        'No neural network is registered under '
                        'a TOY object named `%s`.'
                        % timetools.TOY(name))
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to look up for a neural network '
                    'handled by the seasonal neural network collection '
                    '`%s` of element `%s` based on name `%s`'
                    % (self.name, objecttools.devicename(self), name))
        else:
            return object.__getattribute__(self, name)

    def __setattr__(self, name, value):
        if name.startswith('toy_'):
            try:
                if not isinstance(value, abctools.ANNABC):
                    raise TypeError(
                        '%s has been given, but a value of type '
                        '`ANN` is required.'
                        % objecttools.value_of_type(value).capitalize())
                self._toy2ann[timetools.TOY(name)] = value
                self.refresh()
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to assign a new neural network to '
                    'the seasonal neural network collection `%s` of '
                    'element `%s` based on name `%s`'
                    % (self.name, objecttools.devicename(self), name))
        else:
            object.__setattr__(self, name, value)

    def __delattr__(self, name):
        if name.startswith('toy_'):
            try:
                try:
                    del self._toy2ann[timetools.TOY(name)]
                except KeyError:
                    raise AttributeError(
                        'No neural network is registered under '
                        'a TOY object named `%s`.'
                        % timetools.TOY(name))
                self.refresh()
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to remove a new neural network from '
                    'the seasonal neural network collection `%s` of '
                    'element `%s` based on name `%s`'
                    % (self.name, objecttools.devicename(self), name))
        else:
            object.__delattr__(self, name)

    def __iter__(self):
        for toy, ann_ in sorted(self._toy2ann.items()):
            yield (toy, ann_)

    def __repr__(self):
        if not self:
            return self.name+'()'
        elif (len(self) == 1) and (self.toys[0] == timetools.TOY('1_1_0_0_0')):
            return self.anns[0].assignrepr('%s(' % self.name) + ')'
        lines = []
        blanks = ' '*(len(self.name)+1)
        for idx, (toy, ann_) in enumerate(self):
            if idx == 0:
                prefix = '%s(%s=' % (self.name, toy)
            else:
                prefix = '%s%s=' % (blanks, toy)
            lines.append(ann_.assignrepr(prefix))
        lines[-1] += ')'
        return ',\n'.join(lines)

    def __len__(self):
        return len(self._toy2ann)

    def __dir__(self):
        """
        >>> from hydpy import SeasonalANN, ann
        >>> seasonalann = SeasonalANN()
        >>> seasonalann(ann(nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
        ...                 weights_input=0.0, weights_output=0.0,
        ...                 intercepts_hidden=0.0, intercepts_output=1.0))
        >>> from hydpy.core.objecttools import assignrepr_values
        >>> print(assignrepr_values(sorted(dir(seasonalann)), '', 70))
        NDIM, SPAN, TIME, TYPE, anns, connect, fastaccess, inputs, name,
        nmb_inputs, nmb_outputs, outputs, parameterstep, plot,
        process_actual_input, ratios, refresh, shape, simulationstep, subpars,
        toy_1_1_0_0_0, toys, verify
        """
        return objecttools.dir_(self) + [str(toy) for toy in self.toys]


abctools.ParameterABC.register(SeasonalANN)
abctools.SeasonalANNABC.register(SeasonalANN)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/armatools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
# -*- coding: utf-8 -*-
"""This module provides additional features for module |iuhtools|,
related to Autoregressive-Moving Average (ARMA) models."""
# import...
# ...from standard library
from __future__ import division, print_function
import itertools
import warnings
# ...from site-packages
import numpy
from scipy import integrate
from matplotlib import pyplot
# ...from HydPy
from hydpy import pub
from hydpy.core import autodoctools
from hydpy.core import objecttools
from hydpy.auxs import statstools


class MA(object):
    """Moving Average Model.

    The MA coefficients can be set manually:

    >>> from hydpy import MA
    >>> ma = MA(coefs=(0.8, 0.2))
    >>> ma
    MA(coefs=(0.8, 0.2))
    >>> ma.coefs = 0.2, 0.8
    >>> ma
    MA(coefs=(0.2, 0.8))

    Otherwise they are determined by method |MA.update_coefs|.
    But this requires that a integrable function object is given.
    Usually, this function object is a |IUH| subclass object, but
    (as in the following example) other function objects defining
    instantaneuous unit hydrographs are accepted.  However, they
    should be well-behaved (e.g. be relatively smooth, unimodal,
    strictly positive, unity integral surface in the positive range).

    For educational purposes, some discontinuous functions are applied in
    the following. One can suppress the associated warning messages with
    the following commands:

    >>> import warnings
    >>> from scipy import integrate
    >>> warnings.filterwarnings(
    ... 'ignore', category=integrate.IntegrationWarning)

    The first example is a simple rectangle impuls:

    >>> ma = MA(iuh=lambda x: 0.05 if x < 20.0 else 0.0)
    >>> ma.iuh.moment1 = 10.0
    >>> ma
    MA(coefs=(0.025, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05,
              0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05,
              0.025))

    The number of the coefficients can be modified by changing the
    class attribute |MA.smallest_coeff|:

    >>> ma.smallest_coeff = 0.03
    >>> ma.update_coefs()
    >>> ma
    MA(coefs=(0.025641, 0.051282, 0.051282, 0.051282, 0.051282, 0.051282,
              0.051282, 0.051282, 0.051282, 0.051282, 0.051282, 0.051282,
              0.051282, 0.051282, 0.051282, 0.051282, 0.051282, 0.051282,
              0.051282, 0.051282))


    The first two central moments of the time delay are a usefull measure for
    describing the operation of a MA model:

    >>> ma = MA(iuh=lambda x: 1.0 if x < 1.0 else 0.0)
    >>> ma.iuh.moment1 = 0.5
    >>> ma
    MA(coefs=(0.5, 0.5))
    >>> from hydpy import round_
    >>> round_(ma.moments, 6)
    0.5, 0.5

    The first central moment is the weigthed time delay (mean lag time).
    The second central moment is the weighted mean deviation from the
    mean lag time (diffusion).

    MA objects can return the turning point in the recession part of their
    MA coefficients.  This can be demonstrated for the right side of the
    probability density function of the normal distribution with zero
    mean and a standard deviation (turning point) of 10:

    >>> from scipy import stats
    >>> ma = MA(iuh=lambda x: 2.0*stats.norm.pdf(x, 0.0, 2.0))
    >>> ma.iuh.moment1 = 1.35
    >>> ma
    MA(coefs=(0.195417, 0.346659, 0.24189, 0.13277, 0.057318, 0.019458,
              0.005193, 0.001089, 0.00018, 0.000023, 0.000002, 0.0, 0.0))
    >>> round_(ma.turningpoint)
    2, 0.24189

    Note that the first returned value is the index of the the MA coefficient
    closest to the turning point, and not a high precision estimate of
    the real turning point of the instantaneous unit hydrograph.

    You can also use the following ploting command to verify the position of
    the turning point, which is printed as a red dot.

    >>> ma.plot(threshold=0.9)

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    The turning point detection also works for functions which include
    both a rising and a falling limb.  This can be shown shifting the
    normal distribution to the right:

    >>> ma.iuh = lambda x: 1.02328*stats.norm.pdf(x, 4.0, 2.0)
    >>> ma.iuh.moment1 = 3.94
    >>> ma.update_coefs()
    >>> ma
    MA(coefs=(0.019322, 0.067931, 0.12376, 0.177364, 0.199966, 0.177364,
              0.12376, 0.067931, 0.029326, 0.009956, 0.002657, 0.000557,
              0.000092, 0.000012, 0.000001, 0.0, 0.0))
    >>> round_(ma.turningpoint)
    6, 0.12376

    When no turning point can be detected, an error is raised:

    >>> ma.coefs = 1.0, 1.0, 1.0
    >>> ma.turningpoint
    Traceback (most recent call last):
    ...
    RuntimeError: Not able to detect a turning point in the impulse response \
defined by the MA coefficients 1.0, 1.0, 1.0.

    The next example requires reactivating the warning suppressed above
    (and under Python 2.7 some registry clearing):

    >>> warnings.filterwarnings(
    ...     'error', category=integrate.IntegrationWarning)
    >>> from scipy.integrate import quadpack
    >>> quadpack.__warningregistry__ = {}

    The MA coefficients need to be approximated numerically.  For very
    spiky response function, the underlying integration algorithm might
    fail.  Then it is assumed that the complete mass of the response
    function is placed at a single delay time, defined by the property
    `moment1` of the instantaneous unit hydrograph.  Hopefully, this
    leads to plausible results.  However, we raise an additional warning
    message to allow users to determine the coefficients by a different
    approach :

    >>> ma.iuh = lambda x: 10.0 if 4.2 < x <= 4.3 else 0.0
    >>> ma.iuh.moment1 = 4.25
    >>> ma.update_coefs()
    Traceback (most recent call last):
    ...
    UserWarning: During the determination of the MA coefficients \
corresponding to the instantaneous unit hydrograph ... a numerical \
integration problem occured.  \
Please check the calculated coefficients: 0.0, 0.0, 0.0, 0.0, 0.75, 0.25.
    >>> ma
    MA(coefs=(0.0, 0.0, 0.0, 0.0, 0.75, 0.25))
    """

    smallest_coeff = 1e-9
    """Smalles MA coefficient to be determined at the end of the response."""

    _coefs = None

    def __init__(self, iuh=None, coefs=None):
        self.iuh = iuh
        if coefs is not None:
            self.coefs = coefs

    def _get_coefs(self):
        """|numpy.ndarray| containing all MA coefficents."""
        if self._coefs is None:
            self.update_coefs()
        return self._coefs

    def _set_coefs(self, values):
        self._coefs = numpy.array(values, ndmin=1, dtype=float)

    def _del_coefs(self):
        self._coefs = None

    coefs = property(_get_coefs, _set_coefs, _del_coefs)

    @property
    def order(self):
        """MA order."""
        return len(self.coefs)

    def _quad(self, dt, t):
        return integrate.quad(
            self.iuh, max(t-1.+dt, 0.), t+dt)[0]

    def update_coefs(self):
        """(Re)calculate the MA coefficients based on the instantaneous
        unit hydrograph."""
        coefs = []
        sum_coefs = 0.
        moment1 = self.iuh.moment1
        for t in itertools.count(0., 1.):
            points = (moment1 % 1,) if t <= moment1 <= (t+2.) else ()
            try:
                coef = integrate.quad(
                    self._quad, 0., 1., args=(t,), points=points)[0]
            except integrate.IntegrationWarning:
                idx = int(moment1)
                coefs = numpy.zeros(idx+2, dtype=float)
                weight = (moment1-idx)
                coefs[idx] = (1.-weight)
                coefs[idx+1] = weight
                self.coefs = coefs
                warnings.warn(
                    'During the determination of the MA coefficients '
                    'corresponding to the instantaneous unit hydrograph '
                    '`%s` a numerical integration problem occured.  '
                    'Please check the calculated coefficients: %s.'
                    % (repr(self.iuh), objecttools.repr_values(coefs)))
                break   # pragma: no cover
            sum_coefs += coef
            if (sum_coefs > .9) and (coef < self.smallest_coeff):
                coefs = numpy.array(coefs)
                coefs /= numpy.sum(coefs)
                self.coefs = coefs
                break
            else:
                coefs.append(coef)

    @property
    def turningpoint(self):
        """Turning point (index and value tuple) in the recession part of the
        MA approximation of the instantaneous unit hydrograph."""
        coefs = self.coefs
        old_dc = coefs[1]-coefs[0]
        for idx in range(self.order-2):
            new_dc = coefs[idx+2]-coefs[idx+1]
            if (old_dc < 0.) and (new_dc > old_dc):
                return idx, coefs[idx]
            else:
                old_dc = new_dc
        raise RuntimeError(
            'Not able to detect a turning point in the impulse response '
            'defined by the MA coefficients %s.'
            % objecttools.repr_values(coefs))

    @property
    def delays(self):
        """Time delays related to the individual MA coefficients."""
        return numpy.arange(self.order, dtype=float)

    @property
    def moments(self):
        """The first two time delay weighted statistical moments of the
        MA coefficients."""
        moment1 = statstools.calc_mean_time(self.delays, self.coefs)
        moment2 = statstools.calc_mean_time_deviation(
            self.delays, self.coefs, moment1)
        return numpy.array([moment1, moment2])

    def plot(self, threshold=None, **kwargs):
        """Barplot of the MA coefficients."""
        try:
            # Works under matplotlib 3.
            pyplot.bar(x=self.delays+.5, height=self.coefs,
                       width=1., fill=False, **kwargs)
        except TypeError:   # pragma: no cover
            # Works under matplotlib 2.
            pyplot.bar(left=self.delays+.5, height=self.coefs,
                       width=1., fill=False, **kwargs)
        pyplot.xlabel('time')
        pyplot.ylabel('response')
        if threshold is not None:
            cumsum = numpy.cumsum(self.coefs)
            idx = numpy.where(cumsum > threshold*cumsum[-1])[0][0]
            pyplot.xlim(0., idx)
        idx, value = self.turningpoint
        pyplot.plot(idx, value, 'ro')

    def __repr__(self):
        return objecttools.assignrepr_tuple(self.coefs, 'MA(coefs=', 70) + ')'


class ARMA(object):
    """Autoregressive-Moving Average model.

    All ARMA coefficients can be set manually:

    >>> from hydpy import MA, ARMA
    >>> arma = ARMA(ar_coefs=(0.5,), ma_coefs=(0.3, 0.2))
    >>> arma.coefs
    (array([ 0.5]), array([ 0.3,  0.2]))
    >>> arma
    ARMA(ar_coefs=(0.5,),
         ma_coefs=(0.3, 0.2))

    >>> arma.ar_coefs = ()
    >>> arma.ma_coefs = range(20)
    >>> arma
    ARMA(ar_coefs=(),
         ma_coefs=(0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
                   11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0))

    Otherwise they are determined by method |ARMA.update_coefs|.
    But this requires that a |MA| object is given.  Let us use
    the MA model based on the shifted normal distribution of the
    documentation on class |MA| as an example:

    >>> from scipy import stats
    >>> ma = MA(iuh=lambda x: 1.02328*stats.norm.pdf(x, 4.0, 2.0))
    >>> ma.iuh.moment1 = 3.94
    >>> arma = ARMA(ma_model=ma)
    >>> arma
    ARMA(ar_coefs=(0.680483, -0.228511, 0.047283, -0.006022, 0.000377),
         ma_coefs=(0.019322, 0.054783, 0.08195, 0.107757, 0.104458,
                   0.07637, 0.041095, 0.01581, 0.004132, 0.000663,
                   0.00005))

    To verify that the ARMA model approximates the MA model with sufficient
    accuracy, one can check the central moments of their responses to a
    standard delta time impulse:

    >>> from hydpy import round_
    >>> round_(ma.moments)
    4.110496, 1.926798
    >>> round_(arma.moments)
    4.110496, 1.926798

    On can check the accuray of the approximation directly via the
    property |ARMA.dev_moments|, which is the sum of the absolute values
    of the deviations of both methods:

    >>> round_(arma.dev_moments)
    0.0

    For the first six digits, there is no difference.  However, the total
    number of coefficients is only reduced by one:

    >>> ma.order
    17
    >>> arma.order
    (5, 11)

    To reduce the determined number or AR coefficients, one can set a higher
    AR-related tolerance value:

    >>> arma.max_rel_rmse = 1e-3
    >>> arma.update_coefs()
    >>> arma
    ARMA(ar_coefs=(0.788899, -0.256436, 0.034256),
         ma_coefs=(0.019322, 0.052688, 0.075125, 0.096488, 0.089453,
                   0.060854, 0.029041, 0.008929, 0.001397, 0.000001,
                   -0.000004, 0.00001, -0.000008, -0.000009, -0.000004,
                   -0.000001))

    The number of AR coeffcients is actually reduced.  However, the are
    now even more MA coefficients, possibly trying to compensate the lower
    accuracy of the AR coefficients, and there is a slight decrease in
    the precision of the moments:

    >>> arma.order
    (3, 16)
    >>> round_(arma.moments)
    4.110497, 1.926804
    >>> round_(arma.dev_moments)
    0.000007

    To also reduce the number of MA coefficients, one can set a higher
    MA-related tolerance value:

    >>> arma.max_dev_coefs = 1e-3
    >>> arma.update_coefs()
    >>> arma
    ARMA(ar_coefs=(0.788888, -0.256432, 0.034255),
         ma_coefs=(0.019321, 0.052687, 0.075124, 0.096486, 0.089452,
                   0.060853, 0.02904, 0.008929, 0.001397))

    Now the total number of is in fact decreased, and the loss in accuracy
    is still small:

    >>> arma.order
    (3, 9)
    >>> round_(arma.moments)
    4.110794, 1.927625
    >>> round_(arma.dev_moments)
    0.001125

    Further relaxing the tolerance values results in even less coefficients,
    but also in some slightly negative responses to a standard impulse:

    >>> arma.max_rel_rmse = 1e-2
    >>> arma.max_dev_coefs = 1e-2
    >>> arma.update_coefs()
    Traceback (most recent call last):
    ...
    UserWarning: Note that the smallest response to a standard impulse of the \
determined ARMA model is negative (`-0.000316`).
    >>> arma
    ARMA(ar_coefs=(0.736954, -0.166457),
         ma_coefs=(0.01946, 0.05418, 0.077804, 0.098741, 0.091295,
                   0.060797, 0.027226))
    >>> arma.order
    (2, 7)
    >>> from hydpy import print_values
    >>> print_values(arma.response)
    0.01946, 0.068521, 0.125062, 0.1795, 0.202761, 0.180343, 0.12638,
    0.063117, 0.025477, 0.008269, 0.001853, -0.000011, -0.000316,
    -0.000231, -0.000118, -0.000048, -0.000016

    It seems to be hard to find a parameter efficient approximation to the
    MA model in the given example. Generally, approximating ARMA models to MA
    models is more beneficial when functions with long tails are involved.
    The most extreme example would be a simple exponential decline:

    >>> import numpy
    >>> ma = MA(iuh=lambda x: 0.1*numpy.exp(-0.1*x))
    >>> ma.iuh.moment1 = 6.932
    >>> arma = ARMA(ma_model=ma)

    In the given example a number of 185 MA coefficients can be reduced to a
    total number of three ARMA coefficients with no relevant loss of accuracy:

    >>> ma.order
    185
    >>> arma.order
    (1, 2)
    >>> round_(arma.dev_moments)
    0.0

    Use the following plotting command to see why 2 MA coeffcients instead of
    one are required in the above example:

    >>> arma.plot(threshold=0.9)

    Decreasing the tolerance values too much results in the following errors:

    >>> arma.max_dev_coefs = 0.0
    >>> arma.update_coefs()
    Traceback (most recent call last):
    ...
    RuntimeError: Method `update_ma_coefs` is not able to determine the MA \
coefficients of the ARMA model with the desired accuracy.  You can set the \
tolerance value ´max_dev_coefs` to a higher value.  An accuracy of \
`0.000000000925` has been reached using `185` MA coefficients.
    >>> arma.max_rel_rmse = 0.0
    >>> arma.update_coefs()
    Traceback (most recent call last):
    ...
    RuntimeError: Method `update_ar_coefs` is not able to determine the AR \
coefficients of the ARMA model with the desired accuracy.  You can either \
set the tolerance value `max_rel_rmse` to a higher value or increase the \
allowed `max_ar_order`.  An accuracy of `0.0` has been reached using `10` \
coefficients.
    """

    max_ar_order = 10
    """Maximum number of AR coefficients that are to be determined by method
    |ARMA.update_coefs|."""

    max_rel_rmse = 1e-6
    """Maximum relative root mean squared error to be accepted by method
    |ARMA.update_coefs|."""

    max_dev_coefs = 1e-6
    """Maximum deviation of the sum of all coefficents from one to be accepted
    by method |ARMA.update_coefs|."""

    _ma_coefs = None
    _ar_coefs = None

    def __init__(self, ma_model=None, ar_coefs=None, ma_coefs=None):
        self.ma = ma_model
        if ar_coefs is not None:
            self.ar_coefs = ar_coefs
        if ma_coefs is not None:
            self.ma_coefs = ma_coefs
        self._rel_rmse = None

    @property
    def rel_rmse(self):
        """Relative root mean squared error the last time achieved by method
        |ARMA.update_coefs|."""
        return self._rel_rmse

    def _get_ar_coefs(self):
        """The AR coefficients of the AR model."""
        if self._ar_coefs is None:
            self.update_ar_coefs()
        return self._ar_coefs

    def _set_ar_coefs(self, values):
        self._ar_coefs = numpy.array(values, ndmin=1, dtype=float)

    def _del_ar_coefs(self):
        self._ar_coefs = None

    ar_coefs = property(_get_ar_coefs, _set_ar_coefs, _del_ar_coefs)

    def _get_ma_coefs(self):
        """The MA coefficients of the ARMA model."""
        if self._ma_coefs is None:
            self.update_ma_coefs()
        return self._ma_coefs

    def _set_ma_coefs(self, values):
        self._ma_coefs = numpy.array(values, ndmin=1, dtype=float)

    def _del_ma_coefs(self):
        self._ma_coefs = None

    ma_coefs = property(_get_ma_coefs, _set_ma_coefs, _del_ma_coefs)

    @property
    def coefs(self):
        """Tuple containing both the AR and the MA coefficients."""
        return (self.ar_coefs, self.ma_coefs)

    @property
    def ar_order(self):
        """Number of AR coefficients."""
        return len(self.ar_coefs)

    @property
    def ma_order(self):
        """Number of MA coefficients"""
        return len(self.ma_coefs)

    @property
    def order(self):
        """Number of both the AR and the MA coefficients."""
        return (self.ar_order, self.ma_order)

    def update_coefs(self):
        """Determine both the AR and the MA coefficients."""
        self.update_ar_coefs()
        self.update_ma_coefs()

    @property
    def effective_max_ar_order(self):
        """The maximum number of AR coefficients that shall or can be
        determined.

        It is the minimum of |ARMA.max_ar_order| and the number of
        coefficients of the pure |MA| after their turning point.
        """
        return min(self.max_ar_order, self.ma.order-self.ma.turningpoint[0]-1)

    def update_ar_coefs(self):
        """Determine the AR coefficients.

        The number of AR coefficients is subsequently increased until the
        required precision |ARMA.max_rel_rmse| is reached.  Otherwise,
        a |RuntimeError| is raised.
        """
        del self.ar_coefs
        for ar_order in range(1, self.effective_max_ar_order+1):
            self.calc_all_ar_coefs(ar_order, self.ma)
            if self._rel_rmse < self.max_rel_rmse:
                break
        else:
            with pub.options.reprdigits(12):
                raise RuntimeError(
                    'Method `update_ar_coefs` is not able to determine '
                    'the AR coefficients of the ARMA model with the desired '
                    'accuracy.  You can either set the tolerance value '
                    '`max_rel_rmse` to a higher value or increase the '
                    'allowed `max_ar_order`.  An accuracy of `%s` has been '
                    'reached using `%d` coefficients.'
                    % (objecttools.repr_(self._rel_rmse), ar_order))

    @property
    def dev_moments(self):
        """Sum of the absolute deviations between the central moments of the
        instantaneous unit hydrograph and the ARMA approximation."""
        return numpy.sum(numpy.abs(self.moments-self.ma.moments))

    def norm_coefs(self):
        """Multiply all coefficients by the same factor, so that their sum
        becomes one."""
        sum_coefs = self.sum_coefs
        self.ar_coefs /= sum_coefs
        self.ma_coefs /= sum_coefs

    @property
    def sum_coefs(self):
        """The sum of all AR and MA coefficients"""
        return numpy.sum(self.ar_coefs) + numpy.sum(self.ma_coefs)

    @property
    def dev_coefs(self):
        """Absolute deviation of |ARMA.sum_coefs| from one."""
        return abs(self.sum_coefs-1.)

    def calc_all_ar_coefs(self, ar_order, ma_model):
        """Determine the AR coeffcients based on a least squares approach.

        The argument `ar_order` defines the number of AR coefficients to be
        determined.  The argument `ma_order` defines a pure |MA| model.
        The least squares approach is applied on all those coefficents of the
        pure MA model, which are associated with the part of the recession
        curve behind its turning point.

        The attribute |ARMA.rel_rmse| is updated with the resulting
        relative root mean square error.
        """
        turning_idx, _ = ma_model.turningpoint
        values = ma_model.coefs[turning_idx:]
        self.ar_coefs, residuals = numpy.linalg.lstsq(
            self.get_a(values, ar_order),
            self.get_b(values, ar_order),
            rcond=-1)[:2]
        if len(residuals) == 1:
            self._rel_rmse = numpy.sqrt(residuals[0])/numpy.sum(values)
        else:
            self._rel_rmse = 0.

    @staticmethod
    def get_a(values, n):
        """Extract the independent variables of the given values and return
        them as a matrix with n columns in a form suitable for the least
        squares approach applied in method |ARMA.update_ar_coefs|.
        """
        m = len(values)-n
        a = numpy.empty((m, n), dtype=float)
        for i in range(m):
            i0 = i-1 if i > 0 else None
            i1 = i+n-1
            a[i] = values[i1:i0:-1]
        return numpy.array(a)

    @staticmethod
    def get_b(values, n):
        """Extract the dependent variables of the values in a vector with n
        entries in a form suitable for the least squares approach applied in
        method |ARMA.update_ar_coefs|.
        """
        return numpy.array(values[n:])

    def update_ma_coefs(self):
        """Determine the MA coefficients.

        The number of MA coefficients is subsequently increased until the
        required precision |ARMA.max_dev_coefs| is reached.  Otherwise,
        a |RuntimeError| is raised.
        """
        self.ma_coefs = []
        for ma_order in range(1, self.ma.order+1):
            self.calc_next_ma_coef(ma_order, self.ma)
            if self.dev_coefs < self.max_dev_coefs:
                self.norm_coefs()
                break
        else:
            with pub.options.reprdigits(12):
                raise RuntimeError(
                    'Method `update_ma_coefs` is not able to determine the MA '
                    'coefficients of the ARMA model with the desired accuracy.'
                    '  You can set the tolerance value ´max_dev_coefs` to a '
                    'higher value.  An accuracy of `%s` has been reached '
                    'using `%d` MA coefficients.'
                    % (objecttools.repr_(self.dev_coefs), ma_order))
        if numpy.min(self.response) < 0.:
            warnings.warn(
                'Note that the smallest response to a standard impulse of the '
                'determined ARMA model is negative (`%s`).'
                % objecttools.repr_(numpy.min(self.response)))

    def calc_next_ma_coef(self, ma_order, ma_model):
        """Determine the MA coefficients of the ARMA model based on its
        predetermined AR coefficients and the MA ordinates of the given
        |MA| model.

        The MA coefficients are determined one at a time, beginning with the
        first one.  Each ARMA MA coefficient in set in a manner that allows
        for the exact reproduction of the equivalent pure MA coefficient with
        all relevant ARMA coefficients.
        """
        idx = ma_order-1
        coef = ma_model.coefs[idx]
        for jdx, ar_coef in enumerate(self.ar_coefs):
            zdx = idx-jdx-1
            if zdx >= 0:
                coef -= ar_coef*ma_model.coefs[zdx]
        self.ma_coefs = numpy.concatenate((self.ma_coefs, [coef]))

    @property
    def response(self):
        """Return the response to a standard dt impulse."""
        values = []
        sum_values = 0.
        idx = 0
        ma_coefs = self.ma_coefs
        ar_coefs = self.ar_coefs
        ma_order = self.ma_order
        for idx in range(len(self.ma.delays)):
            value = 0.
            if idx < ma_order:
                value += ma_coefs[idx]
            for jdx, ar_coef in enumerate(ar_coefs):
                zdx = idx-jdx-1
                if zdx >= 0:
                    value += ar_coef*values[zdx]
            values.append(value)
            sum_values += value
        return numpy.array(values)

    @property
    def moments(self):
        """The first two time delay weighted statistical moments of the
        ARMA response."""
        timepoints = self.ma.delays
        response = self.response
        moment1 = statstools.calc_mean_time(timepoints, response)
        moment2 = statstools.calc_mean_time_deviation(
            timepoints, response, moment1)
        return numpy.array([moment1, moment2])

    def plot(self, threshold=None, **kwargs):
        """Barplot of the ARMA response."""
        try:
            # Works under matplotlib 3.
            pyplot.bar(x=self.ma.delays+.5, height=self.response,
                       width=1., fill=False, **kwargs)
        except TypeError:   # pragma: no cover
            # Works under matplotlib 2.
            pyplot.bar(left=self.ma.delays+.5, height=self.response,
                       width=1., fill=False, **kwargs)
        pyplot.xlabel('time')
        pyplot.ylabel('response')
        if threshold is not None:
            cumsum = numpy.cumsum(self.response)
            idx = numpy.where(cumsum > threshold*cumsum[-1])[0][0]
            pyplot.xlim(0., idx)

    def __repr__(self):
        return '%s,\n%s)' % (objecttools.assignrepr_tuple(self.ar_coefs,
                                                          'ARMA(ar_coefs=',
                                                          70),
                             objecttools.assignrepr_tuple(self.ma_coefs,
                                                          '     ma_coefs=',
                                                          70))


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/iuhtools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
# -*- coding: utf-8 -*-
"""This module supports modelling based on instantaneous unit hydrographs.

This module implements some abstract descriptor classes, metaclasses and base
classes.  If you are just interested in applying a certain instantaneous
unit hydrograph (iuh) function or if you want to implement an additional
iuh, see the examples or the source code of class
|TranslationDiffusionEquation|.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import itertools
# ...from site-packages
import numpy
from scipy import special
from matplotlib import pyplot
# ...from Hydpy
from hydpy.core import autodoctools
from hydpy.core import objecttools
from hydpy.auxs import statstools
from hydpy.auxs import armatools


class IUH_Parameter(object):
    """Descriptor base class for |PrimaryParameter| and |SecondaryParameter|.

    The first initialization argument is the parameters name.  Optionally,
    an alternative type (the default type is |float|) and a documentation
    string can be passed.
    """

    def __init__(self, name, type_=float, doc=None):
        self.name = name
        self._name = '_'+name
        self.type_ = type_
        self.__doc__ = ('Instantaneous unit hydrograph parameter %s.' % name
                        if doc is None else str(doc))

    def __get__(self, obj, type_=None):
        return self if obj is None else getattr(obj, self._name, None)

    def _convert_type(self, value):
        try:
            return self.type_(value)
        except BaseException:
            raise TypeError(
                'The value `%s` of type `%s` could not be converted to type '
                '`%s` of the instantaneous unit hydrograph parameter `%s`.'
                % (value, objecttools.classname(value),
                   objecttools.classname(self.type_), self.name))


class PrimaryParameter(IUH_Parameter):
    """Descriptor base class for parameters of instantaneous unit hydrograph
    functions to be defined by the user.

    When a primary parameter value is set or deleted, the master instance is
    instructed to |IUH.update| all secondary parameter values.
    """

    def __set__(self, obj, value):
        value = self._convert_type(value)
        setattr(obj, self._name, value)
        obj.update()

    def __delete__(self, obj):
        setattr(obj, self._name, None)
        obj.update()


class SecondaryParameter(IUH_Parameter):
    """Descriptor base class for parameters of instantaneous unit hydrograph
    functions which can be determined automatically."""

    def __set__(self, obj, value):
        value = self._convert_type(value)
        setattr(obj, self._name, value)

    def __delete__(self, obj):
        setattr(obj, self._name, None)


class MetaIUH(type):
    """Metaclass for class |IUH|.

    For storing |PrimaryParameter| and |SecondaryParameter| in separate
    dictionaries.
    """

    def __new__(cls, name, parents, dict_):
        primary_parameters = {}
        secondary_parameters = {}
        for key, value in dict_.items():
            if isinstance(value, PrimaryParameter):
                primary_parameters[key] = value
            elif isinstance(value, SecondaryParameter):
                secondary_parameters[key] = value
        dict_['_primary_parameters'] = primary_parameters
        dict_['_secondary_parameters'] = secondary_parameters
        return type.__new__(cls, name, parents, dict_)


# Just for making MetaIUH the type of class IUH both in Python 2 and 3:
_MetaIUH = MetaIUH('_MetaIUH', (), {})


class IUH(_MetaIUH):
    """Base class for instantaneous unit hydrograph function objects.

    See class |TranslationDiffusionEquation| for explanations and
    application examples.

    For developers: The string representation does also work for
    parameter-free |IUH| subclasses:

    >>> from hydpy.auxs.iuhtools import IUH
    >>> class Test(IUH):
    ...     pass
    >>> Test()
    Test()
    """

    dt_response = 1e-2
    """Relative stepsize for plotting and analyzing iuh functions."""

    smallest_response = 1e-9
    """Smallest value taken into account for plotting and analyzing iuh
    functions."""

    def __init__(self, **kwargs):
        self.ma = armatools.MA(self)
        self.arma = armatools.ARMA(ma_model=self.ma)
        if kwargs:
            self.set_primary_parameters(**kwargs)

    def set_primary_parameters(self, **kwargs):
        """Set all primary parameters at once."""
        given = sorted(kwargs.keys())
        required = sorted(self._primary_parameters)
        if given == required:
            for (key, value) in kwargs.items():
                setattr(self, key, value)
        else:
            raise ValueError(
                'When passing primary parameter values as initialization '
                'arguments of the instantaneous unit hydrograph class `%s`, '
                'or when using method `set_primary_parameters, one has to '
                'to define all values at once via keyword arguments.  '
                'But instead of the primary parameter names `%s` the '
                'following keywords were given: %s.'
                % (objecttools.classname(self),
                   ', '.join(required), ', '.join(given)))

    @property
    def are_primary_parameters_complete(self):
        """True/False flag that indicates wheter the values of all primary
        parameters are defined or not."""
        for primpar in self._primary_parameters.values():
            if primpar.__get__(self) is None:
                return False
        return True

    def update(self):
        """Delete the coefficients of the pure MA model and also all MA and
        AR coefficients of the ARMA model.  Also calculate or delete the values
        of all secondary iuh parameters, depending on the completeness of the
        values of the primary parameters.
        """
        del self.ma.coefs
        del self.arma.ma_coefs
        del self.arma.ar_coefs
        if self.are_primary_parameters_complete:
            self.calc_secondary_parameters()
        else:
            for secpar in self._secondary_parameters.values():
                secpar.__delete__(self)

    @property
    def delay_response_series(self):
        """A tuple of two numpy arrays, which hold the time delays and the
        associated iuh values respectively."""
        delays = []
        responses = []
        sum_responses = 0.
        for t in itertools.count(self.dt_response/2., self.dt_response):
            delays.append(t)
            response = self(t)
            responses.append(response)
            sum_responses += self.dt_response*response
            if (sum_responses > .9) and (response < self.smallest_response):
                break
        return numpy.array(delays), numpy.array(responses)

    def plot(self, threshold=None, **kwargs):
        """Plot the instanteneous unit hydrograph.

        The optional argument allows for defining a threshold of the cumulative
        sum uf the hydrograph, used to adjust the largest value of the x-axis.
        It must be a value between zero and one.
        """
        delays, responses = self.delay_response_series
        pyplot.plot(delays, responses, **kwargs)
        pyplot.xlabel('time')
        pyplot.ylabel('response')
        if threshold is not None:
            threshold = numpy.clip(threshold, 0., 1.)
            cumsum = numpy.cumsum(responses)
            idx = numpy.where(cumsum >= threshold*cumsum[-1])[0][0]
            pyplot.xlim(0., delays[idx])

    @property
    def moment1(self):
        """The first time delay weighted statistical moment of the
        instantaneous unit hydrograph."""
        delays, response = self.delay_response_series
        return statstools.calc_mean_time(delays, response)

    @property
    def moment2(self):
        """The second time delay weighted statistical momens of the
        instantaneous unit hydrograph."""
        moment1 = self.moment1
        delays, response = self.delay_response_series
        return statstools.calc_mean_time_deviation(
            delays, response, moment1)

    @property
    def moments(self):
        """The first two time delay weighted statistical moments of the
        instantaneous unit hydrograph."""
        return numpy.array([self.moment1, self.moment2])

    def __repr__(self):
        parts = [objecttools.classname(self), '(']
        for (name, primpar) in sorted(self._primary_parameters.items()):
            value = primpar.__get__(self)
            if value is not None:
                parts.extend([name, '=', objecttools.repr_(value), ', '])
        if parts[-1] == ', ':
            parts[-1] = ')'
        else:
            parts.append(')')
        return ''.join(parts)


class TranslationDiffusionEquation(IUH):
    """An instantaneous unit hydrograph based on the `translation diffusion
    equation`.

    The equation used is a linear approximation of the Saint-Venant
    equations for channel routing:

      :math:`h(t) = \\frac{a}{t \\cdot \\sqrt{\\pi \\cdot t}} \\cdot
      e^{-t \\cdot (a/t-b)^2}`

    with:
      :math:`a = \\frac{x}{2 \\cdot \\sqrt{d}}`

      :math:`b = \\frac{u}{2 \\cdot \\sqrt{d}}`

    There are three primary parameter whichs values need to be defined by
    the user:

    >>> from hydpy import TranslationDiffusionEquation
    >>> tde = TranslationDiffusionEquation(u=5., d=15., x=50.)
    >>> tde
    TranslationDiffusionEquation(d=15.0, u=5.0, x=50.0)

    The values of both secondary parameters are determined automatically:

    >>> from hydpy import round_
    >>> round_((tde.a, tde.b))
    6.454972, 0.645497

    The function can principally be evaluated for time delays larger zero,
    but not for zero time delay, which can cause trouble when applying
    numerical integration algorithms.  This is why we clip the given time
    delay to minimum value of 1e-10 internally.  In most cases (like the
    following), the returned result should be workable for integration
    algorithms:

    >>> import numpy
    >>> round_(tde([0.0, 5.0, 10.0, 15.0, 20.0]))
    0.0, 0.040559, 0.115165, 0.031303, 0.00507

    The first delay weighted central moment of the translation diffusion
    equation corresponds to the time lag (`x`/`u`), the second one to
    wave diffusion:

    >>> round_(tde.moments)
    10.0, 3.464101

    Class |TranslationDiffusionEquation| implements its own property
    `moment1` (used in the example above), which is computationally
    more efficient and robust than the one of its base class |IUH|.
    But both normally, both should return very similar values:

    >>> from hydpy.auxs.iuhtools import IUH
    >>> round_(IUH.moment1.fget(tde))
    10.0


    You can also plot the graph corresponding to the actual parameterization:

    >>> tde.plot(threshold=0.9)

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    All instances of the subclasses of |IUH| provide a pure Moving Average
    and an Autoregressive-Moving Average approximation to the dt standard
    impulse of the instantaneous unit hydrograph function.  In the given
    example, the MA approximation involves 57 coefficients, and the ARMA
    approximation invoves 17 coefficients:

    >>> tde.ma.order
    57
    >>> tde.arma.order
    (3, 14)

    The diffusion of the MA model deviates from the iuh function due to
    aggregation.  For the ARMA model, there is also a slight deviation in
    time delay, as the ARMA model itself is only a approximation of the
    MA model:

    >>> round_(tde.ma.moments)
    10.0, 3.488074
    >>> round_(tde.arma.moments)
    10.000091, 3.488377

    For further information on using MA and ARMA models, read the
    documentation on module |armatools|.

    Changing a primary parameter results in an updating of the secondary
    parameters as well as the MA and the ARMA model:

    >>> tde.x = 5.
    >>> round_((tde.a, tde.b))
    0.645497, 0.645497
    >>> tde.ma.order
    37
    >>> tde.arma.order
    (4, 5)

    As long as the primary parameter values are incomplete, no secondary
    parameter values are available:

    >>> del tde.x
    >>> round_((tde.a, tde.b))
    None, None

    Suitable type conversions are performed when new parameter values are set:

    >>> tde.x = '1.'
    >>> tde.x
    1.0

    It a new value cannot be converted, an error is raised:

    >>> tde.x = 'a'
    Traceback (most recent call last):
    ...
    TypeError: The value `a` of type `str` could not be converted to type \
`float` of the instantaneous unit hydrograph parameter `x`.

    When passing parameter values as initialization arguments or when using
    method `set_primary_parameters`, tests for completeness are performed:

    >>> TranslationDiffusionEquation(u=5.0, d=15.0)
    Traceback (most recent call last):
    ...
    ValueError: When passing primary parameter values as initialization \
arguments of the instantaneous unit hydrograph class \
`TranslationDiffusionEquation`, or when using method \
`set_primary_parameters, one has to to define all values at once via \
keyword arguments.  But instead of the primary parameter names `d, u, x` \
the following keywords were given: d, u.
    """
    u = PrimaryParameter('u', doc='Wave velocity.')
    d = PrimaryParameter('d', doc='Diffusion coefficient.')
    x = PrimaryParameter('x', doc='Routing distance.')
    a = SecondaryParameter('a', doc='Distance related coefficient.')
    b = SecondaryParameter('b', doc='Velocity related coefficient.')

    def calc_secondary_parameters(self):
        """Determine the values of the secondary parameters `a` and `b`."""
        self.a = self.x/(2.*self.d**.5)
        self.b = self.u/(2.*self.d**.5)

    def __call__(self, t):
        t = numpy.array(t)
        t = numpy.clip(t, 1e-10, numpy.inf)
        return self.a/(t*(numpy.pi*t)**.5)*numpy.exp(-t*(self.a/t-self.b)**2)

    @property
    def moment1(self):
        """The first time delay weighted statistical moment of the
        translation diffusion equation."""
        return self.x/self.u


class LinearStorageCascade(IUH):
    """An instantaneous unit hydrograph based on the `linear storage cascade`.

    The equation involves the gamma function, allowing for a fractional number
    of storages:

      :math:`h(t) = c \\cdot (t/k)^{n-1} \\cdot e^{-t/k}`

    with:
      :math:`c = \\frac{1}{k \\cdot \\gamma(n)}`

    After defining the values of the two primary parameters, the function
    object can be applied:

    >>> from hydpy import LinearStorageCascade
    >>> lsc = LinearStorageCascade(n=2.5, k=2.)
    >>> from hydpy import round_
    >>> round_(lsc.c)
    0.376126
    >>> import numpy
    >>> round_(lsc(numpy.array([5., 10., 15., 20.])))
    0.122042, 0.028335, 0.004273, 0.00054

    """
    n = PrimaryParameter('n', doc='Number of linear storages.')
    k = PrimaryParameter(
        'k', doc='Time of concentration of each individual storage.')
    c = SecondaryParameter('c', doc='Proportionality factor.')

    def calc_secondary_parameters(self):
        """Determine the value of the secondary parameter `c`."""
        self.c = 1./(self.k*special.gamma(self.n))

    def __call__(self, t):
        return self.c*(t/self.k)**(self.n-1)*numpy.exp(-t/self.k)

    @property
    def moment1(self):
        """The first time delay weighted statistical moment of the
        linear storage cascade."""
        return self.k*self.n


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/networktools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
# -*- coding: utf-8 -*-
"""This module provides features for preparing HydPy networks based on
different data."""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core import objecttools
from hydpy.core import devicetools
from hydpy.core import selectiontools


class RiverBasinNumber(str):
    """A single river basin number (Gewässerkennzahl) based on a guideline
    of the German organisation LAWA.

    See `Länderarbeitsgemeinschaft Wasser: Richtlinie für die
    Gebietsbezeichung und die Verschlüsselung von Fließgewässern (1970)`

    Note that zero fill numbers are ignored:

    >>> RiverBasinNumber(1230)
    RiverBasinNumber(123)
    >>> RiverBasinNumber('0123')
    RiverBasinNumber(123)

    Numbers that cannot be interpreted as a river basin numbers, result
    in the following error message:

    >>> RiverBasinNumber('123A')
    Traceback (most recent call last):
    ...
    ValueError: The given value `123A` could not be interpreted as a river \
basin number.
    """

    def __new__(cls, value):
        try:
            return str.__new__(cls, str(int(value)).strip('0'))
        except ValueError:
            raise ValueError('The given value `%s` could not be interpreted '
                             'as a river basin number.' % value)

    @property
    def is_rivermouth(self):
        """Only true if the river basin number ends with `9`.

        >>> from hydpy import RiverBasinNumber
        >>> RiverBasinNumber(129).is_rivermouth
        True
        >>> RiverBasinNumber(123).is_rivermouth
        False
        """
        return self[-1] == '9'

    @property
    def is_mainchannel(self):
        """Only true if the river basin number ends with an odd number.

        >>> from hydpy import RiverBasinNumber
        >>> for number in range(120, 130):
        ...     rbn = RiverBasinNumber(number)
        ...     print(number, rbn, rbn.is_mainchannel)
        120 12 False
        121 121 True
        122 122 False
        123 123 True
        124 124 False
        125 125 True
        126 126 False
        127 127 True
        128 128 False
        129 129 True
        """
        return int(self[-1]) % 2 == 1

    @property
    def is_tributary(self):
        """Only true if the river basin number ends with an even number.

        >>> from hydpy import RiverBasinNumber
        >>> for number in range(120, 130):
        ...     rbn = RiverBasinNumber(number)
        ...     print(number, rbn, rbn.is_tributary)
        120 12 True
        121 121 False
        122 122 True
        123 123 False
        124 124 True
        125 125 False
        126 126 True
        127 127 False
        128 128 True
        129 129 False
        """
        return int(self[-1]) % 2 == 0

    @property
    def _possible_next_last_initial_digits(self):
        return (digit for digit in ('3', '5', '7', '9') if
                digit > self.rstrip('9')[-1])

    @property
    def possible_next_initial_digits(self):
        """Return a tuple of all potential candidates for the next downstream
        river basin number.

        I think, only the first and the last returned candidate should be of
        relevance.  But to return all possible intermediate candidates might
        be safer river basin number specifications I am not taking into
        account at the moment.

        The candidate numbers might be incomplete.  For example, the next
        number downstream of `123` could be `1251` instead of `125`.

        >>> from hydpy import RiverBasinNumber
        >>> for number in range(120, 130):
        ...     rbn = RiverBasinNumber(number)
        ...     print(number, rbn, rbn.possible_next_initial_digits)
        120 12 ('13', '15', '17', '19')
        121 121 ('123', '125', '127', '129')
        122 122 ('123', '125', '127', '129')
        123 123 ('125', '127', '129')
        124 124 ('125', '127', '129')
        125 125 ('127', '129')
        126 126 ('127', '129')
        127 127 ('129',)
        128 128 ('129',)
        129 129 ('13', '15', '17', '19')
        """
        return tuple(self.rstrip('9')[:-1]+digit for digit
                     in self._possible_next_last_initial_digits)

    @property
    def nmb_digits(self):
        """Number of (significant) digits of a river basin number.

        >>> from hydpy import RiverBasinNumber
        >>> RiverBasinNumber(120).nmb_digits
        2
        """
        return len(self)

    def __repr__(self):
        return 'RiverBasinNumber(%s)' % str.__repr__(self)[1:-1]


class RiverBasinNumbers(tuple):
    """A sorted collection of |RiverBasinNumber| objects.

        >>> from hydpy import RiverBasinNumbers
        >>> RiverBasinNumbers((111, 113, 1129, 11269, 1125, 11261,
        ...                    11262, 1123, 1124, 1122, 1121))
        RiverBasinNumbers((111, 1121, 1122, 1123, 1124, 1125, 11261,
                           11262, 11269, 1129, 113))
    """
    def __new__(cls, values):
        _values = tuple(RiverBasinNumber(value) for value in values)
        return tuple.__new__(cls, sorted(_values))

    def _get_next_numbers(self, riverbasinnumber):
        riverbasinnumber = RiverBasinNumber(riverbasinnumber)
        for pdn1 in riverbasinnumber.possible_next_initial_digits:
            neighbours = [rbn for rbn in self if rbn.startswith(pdn1)]
            if neighbours:
                return min(neighbours)
        else:
            return None

    @property
    def next_numbers(self):
        """A tuple of the next downstream river basin numbers.

        The order of the returned numbers corresponds to the order of the
        numbers contained by the |RiverBasinNumbers| object.

        The number of the subcatchment immediately downstream of the outlet
        subcatchment is not known.  The tuple contains a |None| object
        instead (or multiple |None| objects in case of multiple outlets).

        Eventually, not all possible combinations of river basin numbers
        are covered.  Please keep us informed if you notices a problem
        when applying this algorithm on your data.  At least, the algorithm
        works properly on the following test case provided by Michael
        Wagner (TU Dresden):

        .. image:: LAWA_river-basin-bumbers.png

        At first, only the black arrows are considered, exemplifying the basic
        definition of river basin numbers:

        >>> from hydpy import RiverBasinNumbers
        >>> rbns = RiverBasinNumbers((111, 113, 1129, 11269, 1125, 11261,
        ...                           11262, 1123, 1124, 1122, 1121))
        >>> for this_rbn, next_rbn in zip(rbns, rbns.next_numbers):
        ...    print(this_rbn.ljust(6), next_rbn)
        111    113
        1121   1123
        1122   1123
        1123   1125
        1124   1125
        1125   1129
        11261  11269
        11262  11269
        11269  1129
        1129   113
        113    None

        The coloured arrows exemplify the situation, where some additional
        subdivisions become necessary:

        >>> from hydpy import RiverBasinNumbers
        >>> rbns = RiverBasinNumbers((1111, 1119, 113, 1129, 1127,
        ...                           11269, 1125, 11261, 11262, 11239,
        ...                           11231, 1124, 1122, 1121))
        >>> for this_rbn, next_rbn in zip(rbns, rbns.next_numbers):
        ...    print(this_rbn.ljust(6), next_rbn)
        1111   1119
        1119   113
        1121   11231
        1122   11231
        11231  11239
        11239  1125
        1124   1125
        1125   1127
        11261  11269
        11262  11269
        11269  1127
        1127   1129
        1129   113
        113    None
        """
        return tuple(self._get_next_numbers(rbn) for rbn in self)

    def __repr__(self):
        return objecttools.assignrepr_tuple(self,
                                            'RiverBasinNumbers(',
                                            60) + ')'


class RiverBasinNumbers2Selection(object):
    """Class for defining a |Selection| object (consisting of connected
    nodes and elements) based on given |RiverBasinNumber| objects.

    Note that this class is not intended to cover all possible HydPy
    networks.  So it might be necessary to make some adjustments on
    the returned selection, e.g. to define special names for specific
    elements or nodes.

    All examples of the methods and propertys of
    |RiverBasinNumbers2Selection| are based on the river basin numbers
    defined in the documentation on class |RiverBasinNumbers|.
    """

    def __init__(self, numbers):
        self.supplier_prefix = 'land_'
        self.router_prefix = 'stream_'
        self.node_prefix = 'node_'
        self.last_node = 'node_outlet'
        self.selection_name = 'complete'
        rbns = RiverBasinNumbers(numbers)
        self._up2down = dict(tuple_ for tuple_ in zip(rbns, rbns.next_numbers))

    @property
    def _supplier_numbers(self):
        """A tuple of the numbers of all "supplying" basins."""
        return tuple(self._up2down.keys())

    @property
    def _router_numbers(self):
        """A tuple of the numbers of all "routing" basins."""
        return tuple(up for up in self._up2down.keys()
                     if up in self._up2down.values())

    def _get_nodename(self, string):
        return self.node_prefix + string

    def _get_suppliername(self, string):
        return self.supplier_prefix + string

    def _get_routername(self, string):
        return self.router_prefix + string

    @property
    def supplier_elements(self):
        """A |Elements| collection of all "supplying" basins.

        (All river basins are assumed to supply something to the downstream
        basin.)

        >>> from hydpy import RiverBasinNumbers2Selection
        >>> rbns2s = RiverBasinNumbers2Selection(
        ...                            (111, 113, 1129, 11269, 1125, 11261,
        ...                             11262, 1123, 1124, 1122, 1121))

        The following elements are properly connected to the required
        outlet nodes already:

        >>> for element in rbns2s.supplier_elements:
        ...     print(repr(element))
        Element("land_111",
                outlets="node_113")
        Element("land_1121",
                outlets="node_1123")
        Element("land_1122",
                outlets="node_1123")
        Element("land_1123",
                outlets="node_1125")
        Element("land_1124",
                outlets="node_1125")
        Element("land_1125",
                outlets="node_1129")
        Element("land_11261",
                outlets="node_11269")
        Element("land_11262",
                outlets="node_11269")
        Element("land_11269",
                outlets="node_1129")
        Element("land_1129",
                outlets="node_113")
        Element("land_113",
                outlets="node_outlet")

        It is both possible to change the prefix names of the elements
        and nodes, as long as it results in a valid variable name (e.g.
        does not start with a number):

        >>> rbns2s.supplier_prefix = 'a_'
        >>> rbns2s.node_prefix = 'b_'
        >>> rbns2s.supplier_elements
        Elements("a_111", "a_1121", "a_1122", "a_1123", "a_1124", "a_1125",
                 "a_11261", "a_11262", "a_11269", "a_1129", "a_113")
        """
        elements = devicetools.Elements()
        for supplier in self._supplier_numbers:
            element = self._get_suppliername(supplier)
            try:
                outlet = self._get_nodename(self._up2down[supplier])
            except TypeError:
                outlet = self.last_node
            elements += devicetools.Element(element, outlets=outlet)
        return elements

    @property
    def router_elements(self):
        """A |Elements| collection of all "routing" basins.

        (Only river basins with a upstream basin are assumed to route
        something to the downstream basin.)

        >>> from hydpy import RiverBasinNumbers2Selection
        >>> rbns2s = RiverBasinNumbers2Selection(
        ...                            (111, 113, 1129, 11269, 1125, 11261,
        ...                             11262, 1123, 1124, 1122, 1121))

        The following elements are properly connected to the required
        inlet and outlet nodes already:

        >>> for element in rbns2s.router_elements:
        ...     print(repr(element))
        Element("stream_1123",
                inlets="node_1123",
                outlets="node_1125")
        Element("stream_1125",
                inlets="node_1125",
                outlets="node_1129")
        Element("stream_11269",
                inlets="node_11269",
                outlets="node_1129")
        Element("stream_1129",
                inlets="node_1129",
                outlets="node_113")
        Element("stream_113",
                inlets="node_113",
                outlets="node_outlet")

        It is both possible to change the prefix names of the elements
        and nodes, as long as it results in a valid variable name (e.g.
        does not start with a number):

        >>> rbns2s.router_prefix = 'c_'
        >>> rbns2s.node_prefix = 'd_'
        >>> rbns2s.router_elements
        Elements("c_1123", "c_1125", "c_11269", "c_1129", "c_113")
        """
        elements = devicetools.Elements()
        for router in self._router_numbers:
            element = self._get_routername(router)
            inlet = self._get_nodename(router)
            try:
                outlet = self._get_nodename(self._up2down[router])
            except TypeError:
                outlet = self.last_node
            elements += devicetools.Element(
                            element, inlets=inlet, outlets=outlet)
        return elements

    @property
    def elements(self):
        """Both the "supplying" and the "routing" elements."""
        return self.supplier_elements + self.router_elements

    @property
    def nodes(self):
        """A |Nodes| collection of all required nodes.

        >>> from hydpy import RiverBasinNumbers2Selection
        >>> rbns2s = RiverBasinNumbers2Selection(
        ...                            (111, 113, 1129, 11269, 1125, 11261,
        ...                             11262, 1123, 1124, 1122, 1121))

        Note that the required outlet node is added:

        >>> rbns2s.nodes
        Nodes("node_1123", "node_1125", "node_11269", "node_1129", "node_113",
              "node_outlet")

        It is both possible to change the prefix names of the nodes and
        the name of the outlet node separately:

        >>> rbns2s.node_prefix = 'b_'
        >>> rbns2s.last_node = 'l_node'
        >>> rbns2s.nodes
        Nodes("b_1123", "b_1125", "b_11269", "b_1129", "b_113", "l_node")
        """
        return (devicetools.Nodes(self.node_prefix+routers for
                                  routers in self._router_numbers) +
                devicetools.Node(self.last_node))

    @property
    def selection(self):
        """A complete |Selection| object of all "supplying" and "routing"
        elements and required nodes.

        >>> from hydpy import RiverBasinNumbers2Selection
        >>> rbns2s = RiverBasinNumbers2Selection(
        ...                            (111, 113, 1129, 11269, 1125, 11261,
        ...                             11262, 1123, 1124, 1122, 1121))
        >>> rbns2s.selection
        Selection("complete",
                  elements=("land_111", "land_1121", "land_1122", "land_1123",
                            "land_1124", "land_1125", "land_11261",
                            "land_11262", "land_11269", "land_1129",
                            "land_113", "stream_1123", "stream_1125",
                            "stream_11269", "stream_1129", "stream_113"),
                  nodes=("node_1123", "node_1125", "node_11269", "node_1129",
                         "node_113", "node_outlet"))

        Besides the possible modifications on the names of the different
        nodes and elements, the name of the selection can be set differently:

        >>> rbns2s.selection_name = 'sel'
        >>> from hydpy import pub
        >>> with pub.options.ellipsis(1):
        ...     print(repr(rbns2s.selection))
        Selection("sel",
                  elements=("land_111", ...,"stream_113"),
                  nodes=("node_1123", ...,"node_outlet"))
        """
        return selectiontools.Selection(
                            self.selection_name, self.nodes, self.elements)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/smoothtools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
# -*- coding: utf-8 -*-
"""This module implements features which help to regularize discontinuous
process equations.

.. _Tyralla (2016): http://www.hydrology.ruhr-uni-bochum.de/hydrolgy/mam/download/schriftenreihe_29.pdf

Many hydrological models rely heavily on discontinous equations describing
hydrological processes.  The related "if-else" blocks are often not
theoretically motivated.  Instead, they are thought to ease implementing
ad hoc solutions of different (parts of) process equations without taking
care of the total set of process equations.

There are some reasons to ground new model concepts on mainly continuous
process descriptions. See e.g. `Tyralla (2016)`_ for more a more exhaustive
discussion of this topic.  Nevertheless, one might often want -- least as
a starting point -- to pick single discontinuous but well-established
equations of old model concepts for a new model concept.  The tools
provided by this module can be used to regularize the discontinuities of
such equations.  More concrete, the tools are thought for replacing
discontinous process equations by continuous approximations.

Some of the implemented features are to be applied during model simulations
and are in some other way performance-critical.  These features are defined
in the Cython extension module |smoothutils|.
"""

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
from scipy import optimize
# ...from HydPy
from hydpy.cythons import smoothutils
from hydpy.core import autodoctools


def calc_smoothpar_logistic1(metapar):
    """Return the smoothing parameter corresponding to the given meta
    parameter when using |smooth_logistic1|.

    Calculate the smoothing parameter value corresponding the meta parameter
    value 2.5:

    >>> from hydpy.auxs.smoothtools import calc_smoothpar_logistic1
    >>> smoothpar = calc_smoothpar_logistic1(2.5)

    Using this smoothing parameter value, the output of function
    |smooth_logistic1| differs by 1 % from the related `true`
    discontinuous step function for the input values -2.5 and 2.5
    (which are located at a distance of 2.5 from the position of
    the discontinuity):

    >>> from hydpy.cythons import smoothutils
    >>> from hydpy import round_
    >>> round_(smoothutils.smooth_logistic1(-2.5, smoothpar))
    0.01
    >>> round_(smoothutils.smooth_logistic1(2.5, smoothpar))
    0.99

    For zero or negative meta parameter values, a zero smoothing parameter
    value is returned:

    >>> round_(calc_smoothpar_logistic1(0.0))
    0.0
    >>> round_(calc_smoothpar_logistic1(-1.0))
    0.0
    """
    return max(metapar/numpy.log(99.), 0.)


def _error_smoothpar_logistic2(par, metapar):
    return smoothutils.smooth_logistic2(-metapar, par) - .01


def _smooth_logistic2_derivative(par, metapar):
    return smoothutils.smooth_logistic2_derivative(metapar, par)


def calc_smoothpar_logistic2(metapar):
    """Return the smoothing parameter corresponding to the given meta
    parameter when using |smooth_logistic2|.

    Calculate the smoothing parameter value corresponding the meta parameter
    value 2.5:

    >>> from hydpy.auxs.smoothtools import calc_smoothpar_logistic2
    >>> smoothpar = calc_smoothpar_logistic2(2.5)

    Using this smoothing parameter value, the output of function
    |smooth_logistic2| differs by
    1 % from the related `true` discontinuous step function for the
    input values -2.5 and 2.5 (which are located at a distance of 2.5
    from the position of the discontinuity):

    >>> from hydpy.cythons import smoothutils
    >>> from hydpy import round_
    >>> round_(smoothutils.smooth_logistic2(-2.5, smoothpar))
    0.01
    >>> round_(smoothutils.smooth_logistic2(2.5, smoothpar))
    2.51

    For zero or negative meta parameter values, a zero smoothing parameter
    value is returned:

    >>> round_(calc_smoothpar_logistic2(0.0))
    0.0
    >>> round_(calc_smoothpar_logistic2(-1.0))
    0.0
    """
    if metapar <= 0.:
        return 0.
    else:
        return optimize.newton(_error_smoothpar_logistic2,
                               .3 * metapar**.84,
                               _smooth_logistic2_derivative,
                               args=(metapar,))


def calc_smoothpar_logistic3(metapar):
    """Return the smoothing parameter corresponding to the given meta
    parameter when using |smooth_logistic3|.

    |smooth_logistic3| is only an alias for |smooth_logistic2|.

    Calculate the smoothing parameter value corresponding the meta parameter
    value 2.5:

    >>> from hydpy.auxs.smoothtools import calc_smoothpar_logistic3
    >>> smoothpar = calc_smoothpar_logistic3(2.5)

    Using this smoothing parameter value, the output of function
    |smooth_logistic3| would ideally differs by 1 % from the related
    `true` discontinuous step function for the input values -2.5 and 3.5
    (which are located at a distance of 2.5 from the position of the
    nearest discontinuity):

    >>> from hydpy.cythons import smoothutils
    >>> from hydpy import round_
    >>> round_(smoothutils.smooth_logistic3(-2.5, smoothpar))
    0.009876
    >>> round_(smoothutils.smooth_logistic3(3.5, smoothpar))
    0.990124

    In contrast to the examples shown for functions |smooth_logistic1| and
    |smooth_logistic2|, the smoothing parameter determined for function
    |smooth_logistic3| is not in perfect agreement with the given meta
    parameter.  For most purposes, the resulting error is negligible.
    If one needs a higher accuracy, some iterative refinement should be
    implemented.
    """
    return calc_smoothpar_logistic2(metapar)


def calc_smoothpar_max1(metapar):
    """Return the smoothing parameter corresponding to the given meta
    parameter when using |smooth_max1|.

    |smooth_max1| is only an alias for |smooth_logistic2|.

    Calculate the smoothing parameter value corresponding the meta parameter
    value 2.5:

    >>> from hydpy.auxs.smoothtools import calc_smoothpar_max1
    >>> smoothpar = calc_smoothpar_max1(2.5)

    Using this smoothing parameter value, the output of function
    |smooth_max1| is 0.01 above the usual discontinuous maximum
    function result, if the absolute value of the difference
    between the x and the y value is 2.5:

    >>> from hydpy.cythons import smoothutils
    >>> from hydpy import round_
    >>> round_(smoothutils.smooth_max1(4.0, 1.5, smoothpar))
    4.01
    """
    return calc_smoothpar_logistic2(metapar)


def calc_smoothpar_min1(metapar):
    """Return the smoothing parameter corresponding to the given meta
    parameter when using |smooth_min1|.

    |smooth_min1| is only an alias for |smooth_logistic2|.

    Calculate the smoothing parameter value corresponding the meta parameter
    value 2.5:

    >>> from hydpy.auxs.smoothtools import calc_smoothpar_min1
    >>> smoothpar = calc_smoothpar_min1(2.5)

    Using this smoothing parameter value, the output of function
    |smooth_min1| is 0.01 below the usual discontinuous minimum
    function result, if the absolute value of the difference
    between the x and the y value is 2.5:

    >>> from hydpy.cythons import smoothutils
    >>> from hydpy import round_
    >>> round_(smoothutils.smooth_min1(-4.0, -1.5, smoothpar))
    -4.01
    """
    return calc_smoothpar_logistic2(metapar)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/statstools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
# -*- coding: utf-8 -*-
"""This module implements statistical functionalities frequently used in
hydrological modelling.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
from hydpy import pandas
from scipy import optimize
from scipy import special
# ...from HydPy
from hydpy.core import autodoctools
from hydpy.core import objecttools
from hydpy.auxs import validtools


def prepare_arrays(sim=None, obs=None, node=None, skip_nan=False):
    """Prepare and return two |numpy| arrays based on the given arguments.

    Note that many functions provided by module |statstools| apply function
    |prepare_arrays| internally (e.g. |nse|).  But you can also apply it
    manually, as shown in the following examples.

    Function |prepare_arrays| can extract time series data from |Node|
    objects.  To set up an example for this, we define a initialization
    time period and prepare a |Node| object:

    >>> from hydpy import pub, Timegrid, Timegrids, Node, round_, nan
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '07.01.2000',
    ...                                    '1d'))
    >>> node = Node('test')

    Next, we assign values the `simulation` and the `observation` sequences
    (to do so for the `observation` sequence requires a little trick, as
    its values are normally supposed to be read from a file):

    >>> node.prepare_simseries()
    >>> node.sequences.sim.series = 1.0, nan, nan, nan, 2.0, 3.0
    >>> node.sequences.obs.ramflag = True
    >>> node.sequences.obs._setarray([4.0, 5.0, nan, nan, nan, 6.0])

    Now we can pass the node object to function |prepare_arrays| and
    get the (unmodified) time series data:

    >>> from hydpy import prepare_arrays
    >>> arrays = prepare_arrays(node=node)
    >>> round_(arrays[0])
    1.0, nan, nan, nan, 2.0, 3.0
    >>> round_(arrays[1])
    4.0, 5.0, nan, nan, nan, 6.0

    Alternatively, we can pass directly any iterables (e.g. |list| and
    |tuple| objects) containing the `simulated` and `observed` data:

    >>> arrays = prepare_arrays(sim=list(node.sequences.sim.series),
    ...                         obs=tuple(node.sequences.obs.series))
    >>> round_(arrays[0])
    1.0, nan, nan, nan, 2.0, 3.0
    >>> round_(arrays[1])
    4.0, 5.0, nan, nan, nan, 6.0

    The optional `skip_nan` flag allows to skip all values, which are
    no numbers.  Note that only those pairs of `simulated` and `observed`
    values are returned which do not contain any `nan`:

    >>> arrays = prepare_arrays(node=node, skip_nan=True)
    >>> round_(arrays[0])
    1.0, 3.0
    >>> round_(arrays[1])
    4.0, 6.0

    The final examples show the error messages returned in case of
    invalid combinations of input arguments:

    >>> prepare_arrays()
    Traceback (most recent call last):
    ...
    ValueError: Neither a `Node` object is passed to argument `node` nor \
are arrays passed to arguments `sim` and `obs`.

    >>> prepare_arrays(sim=node.sequences.sim.series, node=node)
    Traceback (most recent call last):
    ...
    ValueError: Values are passed to both arguments `sim` and `node`, \
which is not allowed.

    >>> prepare_arrays(obs=node.sequences.obs.series, node=node)
    Traceback (most recent call last):
    ...
    ValueError: Values are passed to both arguments `obs` and `node`, \
which is not allowed.

    >>> prepare_arrays(sim=node.sequences.sim.series)
    Traceback (most recent call last):
    ...
    ValueError: A value is passed to argument `sim` but \
no value is passed to argument `obs`.

    >>> prepare_arrays(obs=node.sequences.obs.series)
    Traceback (most recent call last):
    ...
    ValueError: A value is passed to argument `obs` but \
no value is passed to argument `sim`.
    """
    if node:
        if sim is not None:
            raise ValueError(
                'Values are passed to both arguments `sim` and `node`, '
                'which is not allowed.')
        if obs is not None:
            raise ValueError(
                'Values are passed to both arguments `obs` and `node`, '
                'which is not allowed.')
        sim = node.sequences.sim.series
        obs = node.sequences.obs.series
    elif (sim is not None) and (obs is None):
        raise ValueError(
            'A value is passed to argument `sim` '
            'but no value is passed to argument `obs`.')
    elif (obs is not None) and (sim is None):
        raise ValueError(
            'A value is passed to argument `obs` '
            'but no value is passed to argument `sim`.')
    elif (sim is None) and (obs is None):
        raise ValueError(
            'Neither a `Node` object is passed to argument `node` nor '
            'are arrays passed to arguments `sim` and `obs`.')
    sim = numpy.asarray(sim)
    obs = numpy.asarray(obs)
    if skip_nan:
        idxs = ~numpy.isnan(sim) * ~numpy.isnan(obs)
        sim = sim[idxs]
        obs = obs[idxs]
    return sim, obs


@objecttools.excmessage_decorator(
    'calculate the Nash-Sutcliffe efficiency')
def nse(sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the efficiency criteria after Nash & Sutcliffe.

    If the simulated values predict the observed values as well
    as the average observed value (regarding the the mean square
    error), the NSE value is zero:

    >>> from hydpy import round_
    >>> from hydpy import nse
    >>> nse(sim=[2.0, 2.0, 2.0], obs=[1.0, 2.0, 3.0])
    0.0
    >>> nse(sim=[0.0, 2.0, 4.0], obs=[1.0, 2.0, 3.0])
    0.0

    For worse and better simulated values the NSE is negative
    or positive, respectively:

    >>> nse(sim=[3.0, 2.0, 1.0], obs=[1.0, 2.0, 3.0])
    -3.0
    >>> nse(sim=[1.0, 2.0, 2.0], obs=[1.0, 2.0, 3.0])
    0.5

    The highest possible value is one:

    >>> nse(sim=[1.0, 2.0, 3.0], obs=[1.0, 2.0, 3.0])
    1.0

    See the documentation on function |prepare_arrays| for some
    additional instructions for use of function |nse|.
    """
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    return 1.-numpy.sum((sim-obs)**2)/numpy.sum((obs-numpy.mean(obs))**2)


@objecttools.excmessage_decorator(
    'calculate the absolute bias')
def bias_abs(sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the absolute difference between the means of the simulated
    and the observed values.

    >>> from hydpy import round_
    >>> from hydpy import bias_abs
    >>> round_(bias_abs(sim=[2.0, 2.0, 2.0], obs=[1.0, 2.0, 3.0]))
    0.0
    >>> round_(bias_abs(sim=[5.0, 2.0, 2.0], obs=[1.0, 2.0, 3.0]))
    1.0
    >>> round_(bias_abs(sim=[1.0, 1.0, 1.0], obs=[1.0, 2.0, 3.0]))
    -1.0

    See the documentation on function |prepare_arrays| for some
    additional instructions for use of function |bias_abs|.
    """
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    return numpy.mean(sim-obs)


@objecttools.excmessage_decorator(
    'calculate the relative bias')
def bias_rel(sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the relative difference between the means of the simulated
    and the observed values.

    >>> from hydpy import round_
    >>> from hydpy import bias_rel
    >>> round_(bias_rel(sim=[2.0, 2.0, 2.0], obs=[1.0, 2.0, 3.0]))
    0.0
    >>> round_(bias_rel(sim=[5.0, 2.0, 2.0], obs=[1.0, 2.0, 3.0]))
    0.5
    >>> round_(bias_rel(sim=[1.0, 1.0, 1.0], obs=[1.0, 2.0, 3.0]))
    -0.5

    See the documentation on function |prepare_arrays| for some
    additional instructions for use of function |bias_rel|.
    """
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    return numpy.mean(sim)/numpy.mean(obs)-1.


@objecttools.excmessage_decorator(
    'calculate the standard deviation ratio')
def std_ratio(sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the ratio between the standard deviation of the simulated
    and the observed values.

    >>> from hydpy import round_
    >>> from hydpy import std_ratio
    >>> round_(std_ratio(sim=[1.0, 2.0, 3.0], obs=[1.0, 2.0, 3.0]))
    0.0
    >>> round_(std_ratio(sim=[1.0, 1.0, 1.0], obs=[1.0, 2.0, 3.0]))
    -1.0
    >>> round_(std_ratio(sim=[0.0, 3.0, 6.0], obs=[1.0, 2.0, 3.0]))
    2.0

    See the documentation on function |prepare_arrays| for some
    additional instructions for use of function |std_ratio|.
    """
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    return numpy.std(sim)/numpy.std(obs)-1.


@objecttools.excmessage_decorator(
    'calculate the Pearson correlation coefficient')
def corr(sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the product-moment correlation coefficient after Pearson.

    >>> from hydpy import round_
    >>> from hydpy import corr
    >>> round_(corr(sim=[0.5, 1.0, 1.5], obs=[1.0, 2.0, 3.0]))
    1.0
    >>> round_(corr(sim=[4.0, 2.0, 0.0], obs=[1.0, 2.0, 3.0]))
    -1.0
    >>> round_(corr(sim=[1.0, 2.0, 1.0], obs=[1.0, 2.0, 3.0]))
    0.0

    See the documentation on function |prepare_arrays| for some
    additional instructions for use of function |corr|.
    """
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    return numpy.corrcoef(sim, obs)[0, 1]


def _pars_sepd(xi, beta):
    # pylint: disable=invalid-name
    gamma1 = special.gamma(3.*(1.+beta)/2.)
    gamma2 = special.gamma((1.+beta)/2.)
    w_beta = gamma1**.5 / (1.+beta) / gamma2**1.5
    c_beta = (gamma1/gamma2)**(1./(1.+beta))
    m_1 = special.gamma(1.+beta) / gamma1**.5 / gamma2**.5
    m_2 = 1.
    mu_xi = m_1*(xi-1./xi)
    sigma_xi = numpy.sqrt((m_2-m_1**2)*(xi**2+1./xi**2)+2*m_1**2-m_2)
    return mu_xi, sigma_xi, w_beta, c_beta


def _pars_h(sigma1, sigma2, sim):
    return sigma1*numpy.mean(sim) + sigma2*sim


@objecttools.excmessage_decorator(
    'calculate the probability densities with the '
    'heteroskedastic skewed exponential power distribution')
def hsepd_pdf(sigma1, sigma2, xi, beta,
              sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the probability densities based on the
    heteroskedastic skewed exponential power distribution.

    For convenience, the required parameters of the probability density
    function as well as the simulated and observed values are stored
    in a dictonary:

    >>> import numpy
    >>> from hydpy import round_
    >>> from hydpy import hsepd_pdf
    >>> general = {'sigma1': 0.2,
    ...            'sigma2': 0.0,
    ...            'xi': 1.0,
    ...            'beta': 0.0,
    ...            'sim': numpy.arange(10.0, 41.0),
    ...            'obs': numpy.full(31, 25.0)}

    The following test function allows the variation of one parameter
    and prints some and plots all of probability density values
    corresponding to different simulated values:

    >>> def test(**kwargs):
    ...     from matplotlib import pyplot
    ...     special = general.copy()
    ...     name, values = list(kwargs.items())[0]
    ...     results = numpy.zeros((len(general['sim']), len(values)+1))
    ...     results[:, 0] = general['sim']
    ...     for jdx, value in enumerate(values):
    ...         special[name] = value
    ...         results[:, jdx+1] = hsepd_pdf(**special)
    ...         pyplot.plot(results[:, 0], results[:, jdx+1],
    ...                     label='%s=%.1f' % (name, value))
    ...     pyplot.legend()
    ...     for idx, result in enumerate(results):
    ...         if not (idx % 5):
    ...             round_(result)

    When varying parameter `beta`, the resulting probabilities correspond
    to the Laplace distribution (1.0), normal distribution (0.0), and the
    uniform distribution (-1.0), respectively.  Note that we use -0.99
    instead of -1.0 for approximating the uniform distribution to prevent
    from running into numerical problems, which are not solved yet:

    >>> test(beta=[1.0, 0.0, -0.99])
    10.0, 0.002032, 0.000886, 0.0
    15.0, 0.008359, 0.010798, 0.0
    20.0, 0.034382, 0.048394, 0.057739
    25.0, 0.141421, 0.079788, 0.057739
    30.0, 0.034382, 0.048394, 0.057739
    35.0, 0.008359, 0.010798, 0.0
    40.0, 0.002032, 0.000886, 0.0

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    When varying parameter `xi`, the resulting density is negatively
    skewed (0.2), symmetric (1.0), and positively skewed (5.0),
    respectively:

    >>> test(xi=[0.2, 1.0, 5.0])
    10.0, 0.0, 0.000886, 0.003175
    15.0, 0.0, 0.010798, 0.012957
    20.0, 0.092845, 0.048394, 0.036341
    25.0, 0.070063, 0.079788, 0.070063
    30.0, 0.036341, 0.048394, 0.092845
    35.0, 0.012957, 0.010798, 0.0
    40.0, 0.003175, 0.000886, 0.0

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    In the above examples, the actual `sigma` (5.0) is calculated by
    multiplying `sigma1` (0.2) with the mean simulated value (25.0),
    internally.  This can be done for modelling homoscedastic errors.
    Instead, `sigma2` is multiplied with the individual simulated values
    to account for heteroscedastic errors.  With increasing values of
    `sigma2`, the resulting densities are modified as follows:

    >>> test(sigma2=[0.0, 0.1, 0.2])
    10.0, 0.000886, 0.002921, 0.005737
    15.0, 0.010798, 0.018795, 0.022831
    20.0, 0.048394, 0.044159, 0.037988
    25.0, 0.079788, 0.053192, 0.039894
    30.0, 0.048394, 0.04102, 0.032708
    35.0, 0.010798, 0.023493, 0.023493
    40.0, 0.000886, 0.011053, 0.015771

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()
    """
    # pylint: disable=invalid-name
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    sigmas = _pars_h(sigma1, sigma2, sim)
    mu_xi, sigma_xi, w_beta, c_beta = _pars_sepd(xi, beta)
    x, mu = obs, sim
    a = (x-mu)/sigmas
    a_xi = numpy.empty(a.shape)
    idxs = mu_xi+sigma_xi*a < 0.
    a_xi[idxs] = numpy.absolute(xi*(mu_xi+sigma_xi*a[idxs]))
    a_xi[~idxs] = numpy.absolute(1./xi*(mu_xi+sigma_xi*a[~idxs]))
    ps = (2.*sigma_xi/(xi+1./xi)*w_beta *
          numpy.exp(-c_beta*a_xi**(2./(1.+beta))))/sigmas
    return ps


def _hsepd_manual(sigma1, sigma2, xi, beta, sim, obs):
    # pylint: disable=invalid-name
    ps = hsepd_pdf(sigma1, sigma2, xi, beta, sim, obs)
    ps[ps < 1e-200] = 1e-200
    return numpy.mean(numpy.log(ps))


@objecttools.excmessage_decorator(
    'calculate an objective value based on method `hsepd_manual`')
def hsepd_manual(sigma1, sigma2, xi, beta,
                 sim=None, obs=None, node=None, skip_nan=False):
    """Calculate the mean of the logarithmised probability densities of the
    'heteroskedastic skewed exponential power distribution.

    The following examples are taken from the documentation of function
    |hsepd_pdf|, which is used by function |hsepd_manual|.  The first
    one deals with a heteroscedastic normal distribution:

    >>> from hydpy import round_
    >>> from hydpy import hsepd_manual
    >>> round_(hsepd_manual(sigma1=0.2, sigma2=0.2,
    ...                     xi=1.0, beta=0.0,
    ...                     sim=numpy.arange(10.0, 41.0),
    ...                     obs=numpy.full(31, 25.0)))
    -3.682842

    The second one is supposed to show to small zero probability density
    values are set to 1e-200 before calculating their logarithm (which
    means that the lowest possible value returned by function
    |hsepd_manual| is approximately -460):

    >>> round_(hsepd_manual(sigma1=0.2, sigma2=0.0,
    ...                     xi=1.0, beta=-0.99,
    ...                     sim=numpy.arange(10.0, 41.0),
    ...                     obs=numpy.full(31, 25.0)))
    -209.539335
    """
    # pylint: disable=invalid-name
    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    return _hsepd_manual(sigma1, sigma2, xi, beta, sim, obs)


@objecttools.excmessage_decorator(
    'calculate an objective value based on method `hsepd`')
def hsepd(sim=None, obs=None, node=None, skip_nan=False,
          inits=None, return_pars=False, silent=True):
    """Calculate the mean of the logarithmised probability densities of the
    'heteroskedastic skewed exponential power distribution.

    Function |hsepd| serves the same purpose as function |hsepd_manual|,
    but tries to estimate the parameters of the heteroscedastic skewed
    exponential distribution via an optimization algorithm.  This
    is shown by generating a random sample.  1000 simulated values
    are scattered around the observed (true) value of 10.0 with a
    standard deviation of 2.0:

    >>> import numpy
    >>> numpy.random.seed(0)
    >>> sim = numpy.random.normal(10.0, 2.0, 1000)
    >>> obs = numpy.full(1000, 10.0)

    First, as a reference, we calculate the "true" value based on
    function |hsepd_manual| and the correct distribution parameters:

    >>> from hydpy import round_
    >>> from hydpy import hsepd, hsepd_manual
    >>> round_(hsepd_manual(sigma1=0.2, sigma2=0.0,
    ...                     xi=1.0, beta=0.0,
    ...                     sim=sim, obs=obs))
    -2.100093

    When using function |hsepd|, the returned value is even a little
    "better":

    >>> round_(hsepd(sim=sim, obs=obs))
    -2.09983

    This is due to the deviation from the random sample to its
    theoretical distribution.  This is reflected by small differences
    between the estimated values and the theoretical values of
    `sigma1` (0.2), , `sigma2` (0.0), `xi` (1.0), and `beta` (0.0).
    The estimated values are returned in the mentioned order through
    enabling the `return_pars` option:

    >>> value, pars = hsepd(sim=sim, obs=obs, return_pars=True)
    >>> round_(pars, decimals=5)
    0.19966, 0.0, 0.96836, 0.0188

    There is no guarantee that the optimization numerical optimization
    algorithm underlying function |hsepd| will always find the parameters
    resulting in the largest value returned by function |hsepd_manual|.
    You can increase its robustness (and decrease computation time) by
    supplying good initial parameter values:

    >>> value, pars = hsepd(sim=sim, obs=obs, return_pars=True,
    ...                     inits=(0.2, 0.0, 1.0, 0.0))
    >>> round_(pars, decimals=5)
    0.19966, 0.0, 0.96836, 0.0188

    However, the following example shows a case when this strategie
    results in worse results:

    >>> value, pars = hsepd(sim=sim, obs=obs, return_pars=True,
    ...                     inits=(0.0, 0.2, 1.0, 0.0))
    >>> round_(value)
    -2.174492
    >>> round_(pars)
    0.0, 0.213179, 1.705485, 0.505112
    """
    # pylint: disable=invalid-name

    def transform(pars):
        """Transform the actual optimization problem into a function to
        be minimized and apply parameter constraints."""
        sigma1, sigma2, xi, beta = constrain(*pars)
        return -_hsepd_manual(sigma1, sigma2, xi, beta, sim, obs)

    def constrain(sigma1, sigma2, xi, beta):
        """Apply constrains on the given parameter values."""
        sigma1 = numpy.clip(sigma1, 0.0, None)
        sigma2 = numpy.clip(sigma2, 0.0, None)
        xi = numpy.clip(xi, 0.1, 10.0)
        beta = numpy.clip(beta, -0.99, 5.0)
        return sigma1, sigma2, xi, beta

    sim, obs = prepare_arrays(sim, obs, node, skip_nan)
    if not inits:
        inits = [0.1, 0.2, 3.0, 1.0]
    values = optimize.fmin(transform, inits,
                           ftol=1e-12, xtol=1e-12,
                           disp=not silent)
    values = constrain(*values)   # pylint: disable=too-many-function-args
    result = _hsepd_manual(*values, sim=sim, obs=obs)
    if return_pars:
        return result, values
    return result


@objecttools.excmessage_decorator(
    'calculate the weighted mean time')
def calc_mean_time(timepoints, weights):
    """Return the weighted mean of the given timepoints.

    With equal given weights, the result is simply the mean of the given
    time points:

    >>> from hydpy import calc_mean_time
    >>> calc_mean_time(timepoints=[3., 7.],
    ...                weights=[2., 2.])
    5.0

    With different weights, the resulting mean time is shifted to the larger
    ones:

    >>> calc_mean_time(timepoints=[3., 7.],
    ...                weights=[1., 3.])
    6.0

    Or, in the most extreme case:

    >>> calc_mean_time(timepoints=[3., 7.],
    ...                weights=[0., 4.])
    7.0

    There will be some checks for input plausibility perfomed, e.g.:

    >>> calc_mean_time(timepoints=[3., 7.],
    ...                weights=[-2., 2.])
    Traceback (most recent call last):
    ...
    ValueError: While trying to calculate the weighted mean time, \
the following error occured: For the following objects, at least \
one value is negative: weights.
    """
    timepoints = numpy.array(timepoints)
    weights = numpy.array(weights)
    validtools.test_equal_shape(timepoints=timepoints, weights=weights)
    validtools.test_non_negative(weights=weights)
    return numpy.dot(timepoints, weights)/numpy.sum(weights)


@objecttools.excmessage_decorator(
    'calculate the weighted time deviation from mean time')
def calc_mean_time_deviation(timepoints, weights, mean_time=None):
    """Return the weighted deviation of the given timepoints from their mean
    time.

    With equal given weights, the is simply the standard deviation of the
    given time points:

    >>> from hydpy import calc_mean_time_deviation
    >>> calc_mean_time_deviation(timepoints=[3., 7.],
    ...                          weights=[2., 2.])
    2.0

    One can pass a precalculated or alternate mean time:

    >>> from hydpy import round_
    >>> round_(calc_mean_time_deviation(timepoints=[3., 7.],
    ...                                 weights=[2., 2.],
    ...                                 mean_time=4.))
    2.236068

    >>> round_(calc_mean_time_deviation(timepoints=[3., 7.],
    ...                                 weights=[1., 3.]))
    1.732051

    Or, in the most extreme case:

    >>> calc_mean_time_deviation(timepoints=[3., 7.],
    ...                          weights=[0., 4.])
    0.0

    There will be some checks for input plausibility perfomed, e.g.:

    >>> calc_mean_time_deviation(timepoints=[3., 7.],
    ...                          weights=[-2., 2.])
    Traceback (most recent call last):
    ...
    ValueError: While trying to calculate the weighted time deviation \
from mean time, the following error occured: For the following objects, \
at least one value is negative: weights.
    """
    timepoints = numpy.array(timepoints)
    weights = numpy.array(weights)
    validtools.test_equal_shape(timepoints=timepoints, weights=weights)
    validtools.test_non_negative(weights=weights)
    if mean_time is None:
        mean_time = calc_mean_time(timepoints, weights)
    return (numpy.sqrt(numpy.dot(weights, (timepoints-mean_time)**2) /
                       numpy.sum(weights)))


@objecttools.excmessage_decorator(
    'evaluate the simulation results of some node objects')
def evaluationtable(nodes, criteria, nodenames=None,
                    critnames=None, skip_nan=False):
    """Return a table containing the results of the given evaluation
    criteria for the given |Node| objects.

    First, we define two nodes with different simulation and observation
    data (see function |prepare_arrays| for some explanations):

    >>> from hydpy import pub, Timegrid, Timegrids, Node, round_, nan
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '04.01.2000',
    ...                                    '1d'))
    >>> nodes = Node('test1'), Node('test2')
    >>> for node in nodes:
    ...     node.prepare_simseries()
    ...     node.sequences.sim.series = 1.0, 2.0, 3.0
    ...     node.sequences.obs.ramflag = True
    ...     node.sequences.obs._setarray([4.0, 5.0, 6.0])
    >>> nodes[0].sequences.sim.series = 1.0, 2.0, 3.0
    >>> nodes[0].sequences.obs._setarray([4.0, 5.0, 6.0])
    >>> nodes[1].sequences.sim.series = 1.0, 2.0, 3.0
    >>> nodes[1].sequences.obs._setarray([3.0, nan, 1.0])

    Selecting functions |corr| and |bias_abs| as evaluation criteria,
    function |evaluationtable| returns the following table (which is
    actually a pandas data frame):

    >>> from hydpy import evaluationtable, corr, bias_abs
    >>> evaluationtable(nodes, (corr, bias_abs))
           corr  bias_abs
    test1   1.0      -3.0
    test2   NaN       NaN

    One can pass alternative names for both the node objects and the
    criteria functions.  Also, `nan` values can be skipped:

    >>> evaluationtable(nodes, (corr, bias_abs),
    ...                 nodenames=('first node', 'second node'),
    ...                 critnames=('corrcoef', 'bias'),
    ...                 skip_nan=True)
                 corrcoef  bias
    first node        1.0  -3.0
    second node      -1.0   0.0

    The number of assigned node objects and criteria functions must
    match the number of givern alternative names:

    >>> evaluationtable(nodes, (corr, bias_abs),
    ...                 nodenames=('first node',))
    Traceback (most recent call last):
    ...
    ValueError: While trying to evaluate the simulation results of some \
node objects, the following error occured: 2 node objects are given \
which does not match with number of given alternative names beeing 1.

    >>> evaluationtable(nodes, (corr, bias_abs),
    ...                 critnames=('corrcoef',))
    Traceback (most recent call last):
    ...
    ValueError: While trying to evaluate the simulation results of some \
node objects, the following error occured: 2 criteria functions are given \
which does not match with number of given alternative names beeing 1.
    """
    if nodenames:
        if len(nodes) != len(nodenames):
            raise ValueError(
                '%d node objects are given which does not match with '
                'number of given alternative names beeing %s.'
                % (len(nodes), len(nodenames)))
    else:
        nodenames = [node.name for node in nodes]
    if critnames:
        if len(criteria) != len(critnames):
            raise ValueError(
                '%d criteria functions are given which does not match '
                'with number of given alternative names beeing %s.'
                % (len(criteria), len(critnames)))
    else:
        critnames = [crit.__name__ for crit in criteria]
    data = numpy.empty((len(nodes), len(criteria)), dtype=float)
    for idx, node in enumerate(nodes):
        sim, obs = prepare_arrays(None, None, node, skip_nan)
        for jdx, criterion in enumerate(criteria):
            data[idx, jdx] = criterion(sim, obs)
    table = pandas.DataFrame(
        data=data, index=nodenames, columns=critnames)
    return table


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/auxs/validtools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
# import...
"""This module implements features for the validation of (numerical) input
data.
"""
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...from HydPy
from hydpy.core import autodoctools


def test_equal_shape(**kwargs):
    """Raise a ValueError if the shapes of the objects given as keywords
    are not equal.

    If all shapes are equal, nothing happens:

    >>> from hydpy.auxs.validtools import test_equal_shape
    >>> test_equal_shape(arr1=numpy.array([1., 2.]),
    ...                  arr2=numpy.array([3., 4.]),
    ...                  arr3=numpy.array([5., 6.]))

    If at least one shape differs, the following error is raised:

    >>> test_equal_shape(arr1=numpy.array([1., 2.]),
    ...                  arr2=numpy.array([3.]),
    ...                  arr3=numpy.array([5., 6.]))
    Traceback (most recent call last):
    ...
    ValueError: The shapes of the following objects are not equal: arr1 (2,), arr2 (1,), arr3 (2,).

    For flexibility in the functions application, it is allowed to pass only
    one array or no arrays at all:

    >>> test_equal_shape(arr1=numpy.array([1., 2.]))
    >>> test_equal_shape()
    """
    names = list(kwargs.keys())
    shapes = numpy.array([numpy.array(array).shape
                          for array in kwargs.values()])
    if any(shapes[:-1] != shapes[1:]):
        raise ValueError(
            'The shapes of the following objects are not equal: %s.'
            % ', '.join('%s %s' % (name, tuple(shape)) for (name, shape)
                        in sorted(zip(names, shapes))))


def test_non_negative(**kwargs):
    """Raise a ValueError if at least one value of the objects given as
    keywords is negative.

    If all values are non negative, nothing happens:

    >>> from hydpy.auxs.validtools import test_non_negative
    >>> test_non_negative(arr1=numpy.array([1., 2.]),
    ...                   arr2=numpy.array([3., 4.]),
    ...                   arr3=numpy.array([5., 6.]))

    If at least one value is negative, the following error is raised:

    >>> test_non_negative(arr1=numpy.array([1., 2.]),
    ...                   arr2=numpy.array([-3., 4.]),
    ...                   arr3=numpy.array([5., 6.]))
    Traceback (most recent call last):
    ...
    ValueError: For the following objects, at least one value is negative: arr2.

    For flexibility in the functions application, it is allowed to pass
    no arrays at all:

    >>> test_non_negative()
    """
    names = list(kwargs.keys())
    negs = [numpy.nanmin(array) < 0. for array in kwargs.values()]
    if any(negs):
        raise ValueError(
            'For the following objects, at least one value is negative: %s.'
            % ', '.join(name for name, neg in sorted(zip(names, negs)) if neg))

autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/conf/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/abctools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
# -*- coding: utf-8 -*-
"""This module provides some abstract base classes.

There are some type checks within the HydPy framework relying on the
build in  function |isinstance|.  In order to keep HydPy "pythonic",
the following abstract base classes are defined.  All calls to |isinstance|
should rely these abstract base classes instead of the respective
original classes.  This helps to build e.g. a new parameter class when
one wants to avoid to inherit from |Parameter|.

At the moment, the provided classes do not provide things like abstract
methods (should be added later).  Just use them to register new classes
that are not actual subclasses of the respective HydPy classes, but
should be handled as if they were.  See class |anntools.ANN| as an example.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import abc
# ...from HydPy
from hydpy import pub
from hydpy.core import autodoctools


if pub.pyversion > 2:
    _ABC = abc.ABC
else:
    class _ABC(object):
        __metaclass__ = abc.ABCMeta


class DocABC(_ABC):
    """ABC base class automatically documenting is registered subclasses."""

    _registry_empty = True

    @classmethod
    def register(cls, subclass):
        """Add information to the documentation of the given abstract base
        class and register the subclass afterwards.

        Subclass the new abstract base class `NewABC` and define some new
        concrete classes (`New1`, `New2`, `New3`) which do not inherit
        from `NewABC`:

        >>> from hydpy.core.abctools import DocABC
        >>> class NewABC(DocABC):
        ...    "A new base class."
        >>> class New1(object):
        ...     "First new class"
        >>> class New2(object):
        ...     "Second new class"
        >>> class New3(object):
        ...     "Third new class"

        The docstring `NewABC` is still the same as defined above:

        >>> print(NewABC.__doc__)
        A new base class.

        Now we register the concrete classes `New1` and `New2`:

        >>> NewABC.register(New2)
        >>> NewABC.register(New1)
        >>> NewABC.register(New2)

        Now the docstring of `NewABC` includes the information about
        the concrete classes already registered:

        >>> print(NewABC.__doc__)
        A new base class.
        <BLANKLINE>
        At the moment, the following classes are registered:
             * :class:`~hydpy.core.abctools.New2`
             * :class:`~hydpy.core.abctools.New1`

        Note that the docstring order is the registration order.
        Also note that the "accidental reregistration" of class
        `New2` does not modify the docstring.

        Now the concrete classes `New1` and `New2` are handled as
        if they were actual subclasses of `NewABC`, but class `New3`
        -- which had not been registered -- is not:

        >>> issubclass(New1, NewABC)
        True
        >>> isinstance(New1(), NewABC)
        True
        >>> issubclass(New2, NewABC)
        True
        >>> isinstance(New2(), NewABC)
        True
        >>> issubclass(New3, NewABC)
        False
        >>> isinstance(New3(), NewABC)
        False
        """
        if cls._registry_empty:
            cls._registry_empty = False
            cls.__doc__ += \
                '\n\nAt the moment, the following classes are registered:'
        if not issubclass(subclass, cls):
            cls.__doc__ += ('\n     * :class:`~%s`'
                            % str(subclass).split("'")[1])
            abc.ABCMeta.register(cls, subclass)


class IterableNonStringABC(_ABC):
    """Abstract base class for checking if an object is iterable but not a
    string."""

    @classmethod
    def __subclasshook__(cls, C):
        if cls is IterableNonStringABC:
            return (hasattr(C, '__iter__') and
                    not (isinstance(C, str) or
                         issubclass(C, str)))
        return NotImplemented


class ElementABC(DocABC):
    """Abstract base class for registering custom |Element| classes."""
    pass


class NodeABC(DocABC):
    """Abstract base class for registering custom |Node| classes."""
    pass


class VariableABC(DocABC):
    """Abstract base class for registering custom |Variable| classes.

    Usually, new classes should either be registered as a parameter
    or a sequence.  Afterwards, they are automatically handled as
    |Variable| subclasses:

    >>> from hydpy.core.abctools import VariableABC, ParameterABC
    >>> class New(object):
    ...     pass
    >>> issubclass(New, VariableABC)
    False
    >>> ParameterABC.register(New)
    >>> issubclass(New, VariableABC)
    True
    """


class ParameterABC(VariableABC):
    """Abstract base class for registering custom |Parameter| classes."""


class ANNABC(DocABC):
    """Abstract base class for registering custom |anntools.ANN| classes."""


class SeasonalANNABC(DocABC):
    """Abstract base class for registering custom |anntools.SeasonalANN|
    classes."""


class IOSequencesABC(DocABC):
    """Abstract base class for registering custom |IOSequences| classes."""


class InputSequencesABC(DocABC):
    """Abstract base class for registering custom |InputSequences| classes."""


class OutputSequencesABC(DocABC):
    """Abstract base class for registering custom "OutputSequences" classes
    like |FluxSequences|."""


class SequenceABC(VariableABC):
    """Abstract base class for registering custom |Sequence| classes."""
    pass


class InputSequenceABC(SequenceABC):
    """Abstract base class for registering custom |InputSequence| classes."""
    pass


class FluxSequenceABC(SequenceABC):
    """Abstract base class for registering custom |FluxSequence| classes."""
    pass


class ConditionSequenceABC(SequenceABC):
    """Abstract base class for registering custom |ConditionSequence| classes.
    """
    pass


class StateSequenceABC(ConditionSequenceABC):
    """Abstract base class for registering custom |StateSequence| classes."""
    pass


class LogSequenceABC(ConditionSequenceABC):
    """Abstract base class for registering custom |LogSequence| classes."""
    pass


class AideSequenceABC(SequenceABC):
    """Abstract base class for registering custom |AideSequence| classes."""
    pass


class LinkSequenceABC(SequenceABC):
    """Abstract base class for registering custom |LinkSequence| classes."""
    pass


class NodeSequenceABC(SequenceABC):
    """Abstract base class for registering custom |NodeSequence| classes."""
    pass


class DateABC(DocABC):
    """Abstract base class for registering custom |Date| classes."""
    pass


class PeriodABC(DocABC):
    """Abstract base class for registering custom |Period| classes."""
    pass


class TimegridABC(DocABC):
    """Abstract base class for registering custom |Timegrid| classes."""
    pass


class TimegridsABC(DocABC):
    """Abstract base class for registering custom |Timegrids| classes."""
    pass


class TOYABC(DocABC):
    """Abstract base class for registering custom |TOY| classes."""
    pass


class ModelABC(DocABC):
    """Abstract base class for registering custom |Model| classes."""
    pass


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/autodoctools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
# -*- coding: utf-8 -*-
"""This module implements tools for increasing the level of automation and
standardisation of the online documentation generated with Sphinx.
"""
# import...
# ...from the Python standard library
from __future__ import division, print_function
import collections
import copy
import datetime
import doctest
import importlib
import inspect
import io
import os
import pkgutil
import types
import unittest
# ...from site-packages
import numpy
import wrapt
# ...from HydPy
import hydpy
from hydpy import builtins
from hydpy import pub
from hydpy import config
from hydpy import auxs
from hydpy import core
from hydpy import cythons
from hydpy import models
from hydpy.cythons.autogen import annutils
from hydpy.cythons.autogen import pointerutils
from hydpy.cythons.autogen import smoothutils


def description(self):
    """Returns the first "paragraph" of the docstring of the given object.

    Note that ugly things like multiple whitespaces and newline characters
    are removed:

    >>> from hydpy.core import autodoctools, objecttools
    >>> autodoctools.description(objecttools.augment_excmessage)
    'Augment an exception message with additional information while keeping \
the original traceback.'

    In case the given object does not define a docstring, the following
    is returned:
    >>> autodoctools.description(type('Test', (), {}))
    'no description available'
    """
    if self.__doc__ in (None, ''):
        return 'no description available'
    return ' '.join(self.__doc__.split('\n\n')[0].split())


_PAR_SPEC2CAPT = collections.OrderedDict((('parameters', 'Parameter tools'),
                                          ('constants', 'Constants'),
                                          ('control', 'Control parameters'),
                                          ('derived', 'Derived parameters')))

_SEQ_SPEC2CAPT = collections.OrderedDict((('sequences', 'Sequence tools'),
                                          ('inputs', 'Input sequences'),
                                          ('fluxes', 'Flux sequences'),
                                          ('states', 'State sequences'),
                                          ('logs', 'Log sequences'),
                                          ('inlets', 'Inlet sequences'),
                                          ('outlets', 'Outlet sequences'),
                                          ('receivers', 'Receiver sequences'),
                                          ('senders', 'Sender sequences'),
                                          ('aides', 'Aide sequences')))

_all_spec2capt = _PAR_SPEC2CAPT.copy()   # pylint: disable=invalid-name
_all_spec2capt.update(_SEQ_SPEC2CAPT)


@wrapt.decorator
def make_autodoc_optional(wrapped, instance, args, kwargs):
    """Decorate function related to automatic documentation refinement,
    so that they will be applied only when requested (when `use_autodoc`
    of module |config| is `True`) or when possible (when `HydPy` is not
    frozen/bundled)."""
    if config.use_autodoc and not pub._is_hydpy_bundled:
        return wrapped(*args, **kwargs)
    return None


def _add_title(title, marker):
    """Return a title for a basemodels docstring."""
    return ['', title, marker*len(title)]


def _add_lines(specification, module):
    """Return autodoc commands for a basemodels docstring.

    Note that `collection classes` (e.g. `Model`, `ControlParameters`,
    `InputSequences` are placed on top of the respective section and the
    `contained classes` (e.g. model methods, `ControlParameter` instances,
    `InputSequence` instances at the bottom.  This differs from the order
    of their definition in the respective modules, but results in a better
    documentation structure.
    """
    caption = _all_spec2capt.get(specification, 'dummy')
    if caption.split()[-1] in ('parameters', 'sequences'):
        exists_collectionclass = True
        name_collectionclass = caption.title().replace(' ', '')
    else:
        exists_collectionclass = False
    lines = []
    if specification == 'model':
        lines += ['',
                  '.. autoclass:: ' + module.__name__ + '.Model',
                  '    :members:',
                  '    :show-inheritance:']
    elif exists_collectionclass:
        lines += ['',
                  '.. autoclass:: %s.%s' % (module.__name__,
                                            name_collectionclass),
                  '    :members:',
                  '    :show-inheritance:']
    lines += ['',
              '.. automodule:: ' + module.__name__,
              '    :members:',
              '    :show-inheritance:']
    if specification == 'model':
        lines += ['    :exclude-members: Model']
    elif exists_collectionclass:
        lines += ['    :exclude-members: ' + name_collectionclass]
    return lines


@make_autodoc_optional
def autodoc_basemodel():
    """Add an exhaustive docstring to the `__init__` module of a basemodel.

    One just has to write `autodoc_basemodel()` at the bottom of an `__init__`
    module of a basemodel, and all model, parameter and sequence information
    are appended to the modules docstring.  The resulting docstring is suitable
    automatic documentation generation via `Sphinx` and `autodoc`.  Hence
    it helps in constructing HydPy's online documentation and supports the
    embeded help feature of `Spyder` (to see the result, import the package
    of an arbitrary basemodel, e.g. `from hydpy.models import lland` and
    press `cntr+i` with the cursor placed on `lland` written in the IPython
    console afterwards).

    Note that the resulting documentation will be complete only when the
    modules of the basemodel are named in the standard way, e.g. `lland_model`,
    `lland_control`, `lland_inputs`.
    """
    namespace = inspect.currentframe().f_back.f_back.f_locals
    doc = namespace.get('__doc__')
    if doc is None:
        doc = ''
    basemodulename = namespace['__name__'].split('.')[-1]
    modules = {key: value for key, value in namespace.items()
               if (isinstance(value, types.ModuleType) and
                   key.startswith(basemodulename+'_'))}
    substituter = Substituter(hydpy.substituter)
    lines = []
    specification = 'model'
    modulename = basemodulename+'_'+specification
    if modulename in modules:
        module = modules[modulename]
        lines += _add_title('Model features', '-')
        lines += _add_lines(specification, module)
        substituter.add_module(module)
    for (spec2capt, title) in zip((_PAR_SPEC2CAPT, _SEQ_SPEC2CAPT),
                                  ('Parameter features', 'Sequence features')):
        new_lines = _add_title(title, '-')
        found_module = False
        for (specification, caption) in spec2capt.items():
            modulename = basemodulename+'_'+specification
            module = modules.get(modulename)
            if module:
                found_module = True
                new_lines += _add_title(caption, '.')
                new_lines += _add_lines(specification, module)
                substituter.add_module(module)
        if found_module:
            lines += new_lines
    doc += '\n'.join(lines)
    namespace['__doc__'] = doc
    basemodule = importlib.import_module(namespace['__name__'])
    substituter.add_module(basemodule)
    substituter.update_masters()
    namespace['substituter'] = substituter


@make_autodoc_optional
def autodoc_applicationmodel():
    """Improves the docstrings of application models when called
    at the bottom of the respective module.

    |autodoc_applicationmodel| requires, similar to
    |autodoc_basemodel|, that both the application model and its
    base model are defined in the conventional way.
    """
    namespace = inspect.currentframe().f_back.f_back.f_locals
    doc = namespace.get('__doc__')
    if doc is None:
        doc = ''
    name_applicationmodel = namespace['__name__']
    module_applicationmodel = importlib.import_module(name_applicationmodel)
    name_basemodel = name_applicationmodel.split('_')[0]
    module_basemodel = importlib.import_module(name_basemodel)
    substituter = Substituter(module_basemodel.substituter)
    substituter.add_module(module_applicationmodel)
    substituter.update_masters()
    namespace['substituter'] = substituter


class Substituter(object):
    """Implements a HydPy specific docstring substitution mechanism."""

    def __init__(self, master=None):
        self.master = master
        if master:
            self._short2long = copy.deepcopy(master._short2long)
            self._medium2long = copy.deepcopy(master._medium2long)
            self._blacklist = copy.deepcopy(master._blacklist)
        else:
            self._short2long = {}
            self._medium2long = {}
            self._blacklist = set()

    @staticmethod
    def consider_member(name_member, member, module):
        """Return |True| if the given member should be add to the
        substitutions. If not return |False|.

        Some examples based on the site-package |numpy|:

        >>> from hydpy.core.autodoctools import Substituter
        >>> import numpy

        A constant like |nan| should be added:

        >>> Substituter.consider_member(
        ...     'nan', numpy.nan, numpy)
        True

        Members with a prefixed underscore should not be added:

        >>> Substituter.consider_member(
        ...     '_NoValue', numpy._NoValue, numpy)
        False

        Members that are actually imported modules should not be added:

        >>> Substituter.consider_member(
        ...     'warnings', numpy.warnings, numpy)
        False

        Members that are actually defined in other modules should
        not be added:

        >>> numpy.Substituter = Substituter
        >>> Substituter.consider_member(
        ...     'Substituter', numpy.Substituter, numpy)
        False
        >>> del numpy.Substituter

        Members that are defined in submodules of a given package
        (either from the standard library or from site-packages)
        should be added...

        >>> Substituter.consider_member(
        ...     'clip', numpy.clip, numpy)
        True

        ...but not members defined in :ref:`HydPy` submodules:

        >>> import hydpy
        >>> Substituter.consider_member(
        ...     'Node', hydpy.Node, hydpy)
        False
        """
        if name_member.startswith('_'):
            return False
        if inspect.ismodule(member):
            return False
        real_module = getattr(member, '__module__', None)
        if not real_module:
            return True
        if real_module != module.__name__:
            if 'hydpy' in real_module:
                return False
            elif module.__name__ not in real_module:
                return False
        return True

    @staticmethod
    def get_role(member, cython=False):
        """Return the reStructuredText role `func`, `class`, or `const`
        best describing the given member.

        Some examples based on the site-package |numpy|.  |numpy.clip|
        is a function:

        >>> from hydpy.core.autodoctools import Substituter
        >>> import numpy
        >>> Substituter.get_role(numpy.clip)
        'func'

        |numpy.ndarray| is a class:

        >>> Substituter.get_role(numpy.ndarray)
        'class'

        |numpy.ndarray.clip| is a method, for which also the `function`
        role is returned:

        >>> Substituter.get_role(numpy.ndarray.clip)
        'func'

        For everything else the `constant` role is returned:

        >>> Substituter.get_role(numpy.nan)
        'const'

        When analysing cython extension modules, set the option `cython`
        flag to |True|.  |Double| is correctly identified as a class:

        >>> from hydpy.cythons import pointerutils
        >>> Substituter.get_role(pointerutils.Double, cython=True)
        'class'

        Only with the `cython` flag beeing |True|, for everything else
        the `function` text role is returned (doesn't make sense here,
        but the |numpy| module is not something defined in module
        |pointerutils| anyway):

        >>> Substituter.get_role(pointerutils.numpy, cython=True)
        'func'
        """
        if inspect.isroutine(member) or isinstance(member, numpy.ufunc):
            return 'func'
        elif inspect.isclass(member):
            return 'class'
        elif cython:
            return 'func'
        return 'const'

    def add_substitution(self, short, medium, long, module):
        """Add the given substitutions both as a `short2long` and a
        `medium2long` mapping.

        Assume `variable1` is defined in the hydpy module `module1` and the
        short and medium descriptions are `var1` and `mod1.var1`:

        >>> import types
        >>> module1 = types.ModuleType('hydpy.module1')
        >>> from hydpy.core.autodoctools import Substituter
        >>> substituter = Substituter()
        >>> substituter.add_substitution(
        ...     'var1', 'mod1.var1', 'module1.variable1', module1)
        >>> print(substituter.get_commands())
        .. var1 replace:: module1.variable1
        .. mod1.var1 replace:: module1.variable1

        Adding `variable2` of `module2` has no effect on the predefined
        substitutions:

        >>> module2 = types.ModuleType('hydpy.module2')
        >>> substituter.add_substitution(
        ...     'var2', 'mod2.var2', 'module2.variable2', module2)
        >>> print(substituter.get_commands())
        .. var1 replace:: module1.variable1
        .. var2 replace:: module2.variable2
        .. mod1.var1 replace:: module1.variable1
        .. mod2.var2 replace:: module2.variable2

        But when adding `variable1` of `module2`, the `short2long` mapping
        of `variable1` would become inconclusive, which is why the new
        one (related to `module2`) is not stored and the old one (related
        to `module1`) is removed:

        >>> substituter.add_substitution(
        ...     'var1', 'mod2.var1', 'module2.variable1', module2)
        >>> print(substituter.get_commands())
        .. var2 replace:: module2.variable2
        .. mod1.var1 replace:: module1.variable1
        .. mod2.var1 replace:: module2.variable1
        .. mod2.var2 replace:: module2.variable2

        Adding `variable2` of `module2` accidentally again, does not
        result in any undesired side-effects:

        >>> substituter.add_substitution(
        ...     'var2', 'mod2.var2', 'module2.variable2', module2)
        >>> print(substituter.get_commands())
        .. var2 replace:: module2.variable2
        .. mod1.var1 replace:: module1.variable1
        .. mod2.var1 replace:: module2.variable1
        .. mod2.var2 replace:: module2.variable2

        In order to reduce the risk of name conflicts, only the
        `medium2long` mapping is supported for modules not part of the
        :ref:`HydPy` package:

        >>> module3 = types.ModuleType('module3')
        >>> substituter.add_substitution(
        ...     'var3', 'mod3.var3', 'module3.variable3', module3)
        >>> print(substituter.get_commands())
        .. var2 replace:: module2.variable2
        .. mod1.var1 replace:: module1.variable1
        .. mod2.var1 replace:: module2.variable1
        .. mod2.var2 replace:: module2.variable2
        .. mod3.var3 replace:: module3.variable3

        The only exception to this rule is |builtins|, for which only
        the `short2long` mapping is supported (note also, that the
        module name `builtins` is removed from string `long`):

        >>> from hydpy import builtins
        >>> substituter.add_substitution(
        ...     'str', 'blt.str', ':func:`~builtins.str`', builtins)
        >>> print(substituter.get_commands())
        .. str replace:: :func:`str`
        .. var2 replace:: module2.variable2
        .. mod1.var1 replace:: module1.variable1
        .. mod2.var1 replace:: module2.variable1
        .. mod2.var2 replace:: module2.variable2
        .. mod3.var3 replace:: module3.variable3
        """
        name = module.__name__
        if 'builtin' in name:
            self._short2long[short] = long.split('~')[0] + long.split('.')[-1]
        else:
            if ('hydpy' in name) and (short not in self._blacklist):
                if short in self._short2long:
                    if self._short2long[short] != long:
                        self._blacklist.add(short)
                        del self._short2long[short]
                else:
                    self._short2long[short] = long
            self._medium2long[medium] = long

    def add_module(self, module, cython=False):
        """Add the given module, its members, and their submembers.

        The first examples are based on the site-package |numpy|: which
        is passed to method |Substituter.add_module|:

        >>> from hydpy.core.autodoctools import Substituter
        >>> substituter = Substituter()
        >>> import numpy
        >>> substituter.add_module(numpy)

        Firstly, the module itself is added:

        >>> substituter.find('|numpy|')
        |numpy| :mod:`~numpy`

        Secondly, constants like |numpy.nan| are added:

        >>> substituter.find('|numpy.nan|')
        |numpy.nan| :const:`~numpy.nan`

        Thirdly, functions like |numpy.clip| are added:

        >>> substituter.find('|numpy.clip|')
        |numpy.clip| :func:`~numpy.clip`

        Fourthly, clases line |numpy.ndarray| are added:

        >>> substituter.find('|numpy.ndarray|')
        |numpy.ndarray| :class:`~numpy.ndarray`

        When adding Cython modules, the `cython` flag should be set |True|:

        >>> from hydpy.cythons import pointerutils
        >>> substituter.add_module(pointerutils, cython=True)
        >>> substituter.find('set_pointer')
        |PPDouble.set_pointer| \
:func:`~hydpy.cythons.autogen.pointerutils.PPDouble.set_pointer`
        |pointerutils.PPDouble.set_pointer| \
:func:`~hydpy.cythons.autogen.pointerutils.PPDouble.set_pointer`
        """
        name_module = module.__name__.split('.')[-1]
        short = ('|%s|'
                 % name_module)
        long = (':mod:`~%s`'
                % module.__name__)
        self._short2long[short] = long
        for (name_member, member) in vars(module).items():
            if self.consider_member(
                    name_member, member, module):
                role = self.get_role(member, cython)
                short = ('|%s|'
                         % name_member)
                medium = ('|%s.%s|'
                          % (name_module,
                             name_member))
                long = (':%s:`~%s.%s`'
                        % (role,
                           module.__name__,
                           name_member))
                self.add_substitution(short, medium, long, module)
                if inspect.isclass(member):
                    for name_submember, submember in vars(member).items():
                        if self.consider_member(
                                name_submember, submember, module):
                            role = self.get_role(submember, cython)
                            short = ('|%s.%s|'
                                     % (name_member,
                                        name_submember))
                            medium = ('|%s.%s.%s|'
                                      % (name_module,
                                         name_member,
                                         name_submember))
                            long = (':%s:`~%s.%s.%s`'
                                    % (role,
                                       module.__name__,
                                       name_member,
                                       name_submember))
                            self.add_substitution(short, medium, long, module)

    def add_modules(self, package):
        """Add the modules of the given package without their members."""
        for name in os.listdir(package.__path__[0]):
            if name.startswith('_'):
                continue
            name = name.split('.')[0]
            short = '|%s|' % name
            long = ':mod:`~%s.%s`' % (package.__package__, name)
            self._short2long[short] = long

    def update_masters(self):
        """Update all `master` |Substituter| objects.

        If a |Substituter| objects is passed to the constructor of another
        |Substituter| object, it becomes its `master`:

        >>> from hydpy.core.autodoctools import Substituter
        >>> sub1 = Substituter()
        >>> from hydpy.core import devicetools
        >>> sub1.add_module(devicetools)
        >>> sub2 = Substituter(sub1)
        >>> sub3 = Substituter(sub2)
        >>> sub3.master.master is sub1
        True

        During initialization, all mappings handled by the master object
        are passed to its slave:

        >>> sub3.find('Node|')
        |Node| :class:`~hydpy.core.devicetools.Node`
        |devicetools.Node| :class:`~hydpy.core.devicetools.Node`


        Updating a slave, does not affect its master directly:

        >>> from hydpy.core import hydpytools
        >>> sub3.add_module(hydpytools)
        >>> sub3.find('HydPy|')
        |HydPy| :class:`~hydpy.core.hydpytools.HydPy`
        |hydpytools.HydPy| :class:`~hydpy.core.hydpytools.HydPy`
        >>> sub2.find('HydPy|')

        Through calling |Substituter.update_masters|, the `medium2long`
        mappings are passed the slave to its master:

        >>> sub3.update_masters()
        >>> sub2.find('HydPy|')
        |hydpytools.HydPy| :class:`~hydpy.core.hydpytools.HydPy`

        Then each master object updates its own master object also:

        >>> sub1.find('HydPy|')
        |hydpytools.HydPy| :class:`~hydpy.core.hydpytools.HydPy`
        """
        if self.master is not None:
            self.master._medium2long.update(self._medium2long)
            self.master.update_masters()

    def get_commands(self, source=None):
        """Return a string containing multiple `reStructuredText`
        replacements with the substitutions currently defined.

        Some examples based on the subpackage |optiontools|:

        >>> from hydpy.core.autodoctools import Substituter
        >>> substituter = Substituter()
        >>> from hydpy.core import optiontools
        >>> substituter.add_module(optiontools)

        When calling |Substituter.get_commands| with the `source`
        argument, the complete `short2long` and `medium2long` mappings
        are translated into replacement commands (only a few of them
        are shown):

        >>> print(substituter.get_commands())
        .. |Options.checkseries| replace:: \
:const:`~hydpy.core.optiontools.Options.checkseries`
        .. |Options.dirverbose| replace:: \
:const:`~hydpy.core.optiontools.Options.dirverbose`
        ...
        .. |optiontools.Options.warntrim| replace:: \
:const:`~hydpy.core.optiontools.Options.warntrim`
        .. |optiontools.Options| replace:: \
:class:`~hydpy.core.optiontools.Options`

        Through passing a string (usually the source code of a file
        to be documented), only the replacement commands relevant for
        this string are translated:

        >>> from hydpy.core import objecttools
        >>> import inspect
        >>> source = inspect.getsource(objecttools)
        >>> print(substituter.get_commands(source))
        .. |Options.reprdigits| replace:: \
:const:`~hydpy.core.optiontools.Options.reprdigits`
        """
        commands = []
        for key, value in self:
            if (source is None) or (key in source):
                commands.append('.. %s replace:: %s' % (key, value))
        return '\n'.join(commands)

    def find(self, text):
        """Print all substitutions that include the given text string."""
        for key, value in self:
            if (text in key) or (text in value):
                print(key, value)

    def __iter__(self):
        for item in sorted(self._short2long.items()):
            yield item
        for item in sorted(self._medium2long.items()):
            yield item


@make_autodoc_optional
def prepare_mainsubstituter():
    """Prepare and return a |Substituter| object for the main `__init__`
    file of :ref:`HydPy`."""
    substituter = Substituter()
    for module in (builtins, numpy, datetime, unittest, doctest, inspect, io):
        substituter.add_module(module)
    for subpackage in (auxs, core, cythons):
        for dummy, name, dummy in pkgutil.walk_packages(subpackage.__path__):
            full_name = subpackage.__name__ + '.' + name
            substituter.add_module(importlib.import_module(full_name))
    substituter.add_modules(models)
    for cymodule in (annutils, smoothutils, pointerutils):
        substituter.add_module(cymodule, cython=True)
    substituter._short2long['|pub|'] = ':mod:`~hydpy.pub`'
    substituter._short2long['|config|'] = ':mod:`~hydpy.config`'
    return substituter


def _number_of_line(member_tuple):
    """Try to return the number of the first line of the definition of a
    member of a module."""
    member = member_tuple[1]
    try:
        return member.__code__.co_firstlineno
    except AttributeError:
        pass
    try:
        return inspect.findsource(member)[1]
    except BaseException:
        pass
    for value in vars(member).values():
        try:
            return value.__code__.co_firstlineno
        except AttributeError:
            pass
    return 0


@make_autodoc_optional
def autodoc_module():
    """Add a short summary of all implemented members to a modules docstring.

    Just write `autodoctools.autodoc_module()` at the very bottom of the
    module.

    Note that function |autodoc_module| is not thought to be used for
    modules defining models.  For base models, see function
    |autodoc_basemodel| instead.
    """
    module = inspect.getmodule(inspect.currentframe().f_back.f_back)
    doc = module.__doc__
    if doc is None:
        doc = ''
    lines = ['\n\nModule :mod:`~%s` implements the following members:\n'
             % module.__name__]
    members = []
    for (name, member) in inspect.getmembers(module):
        if ((not name.startswith('_')) and
                (inspect.getmodule(member) is module)):
            members.append((name, member))
    members = sorted(members, key=_number_of_line)
    for (name, member) in members:
        if inspect.isfunction(member):
            type_ = 'func'
        elif inspect.isclass(member):
            type_ = 'class'
        else:
            type_ = 'obj'
        lines.append('      * :%s:`~%s` %s'
                     % (type_, name, description(member)))
    module.__doc__ = doc + '\n\n' + '\n'.join(lines) + '\n\n' + 80*'_'


autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/auxfiletools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
# -*- coding: utf-8 -*-
"""This module supports writing auxiliary files.

In HydPy, parameter values are usually not shared between different
model objects handled by different elements, even if the model objects
are of the same type (e.g. HBV).  This offers flexibility in applying
different parameterization schemes.  But very often, modellers prefer
to use a very limited amount of values for certain parameters (at least
within hydrologically homogeneous regions).  Hence, the downside of
this flexibility is that the same parameter values might be defined in
hundreds or even thousands of parameter control files (one file for
each model/element).

To decrease this redundancy, HydPy allows for passing names of
`auxiliary` control files to parameters defined within `normal`
control files.  The actual parameter values are than read from the
auxiliary files, each one possibly referenced within a large number
of control files.

Reading parameters from `normal` and `auxiliary` control files is
straightforward.   But storing some parameters in a large number
of `normal` control files and some other parameters in a small number
of `auxiliary` files can be a little complicated.  The features
implemented in |auxfiletools| are a means to perform such actions in a
semi-automated manner (another means are the selection mechanism
implemented in module |selectiontools|).
"""
# import...
# ...from standard library
from __future__ import division, print_function
import copy
import importlib
import types
# ...from HydPy
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import importtools
from hydpy.core import objecttools
from hydpy.core import parametertools


class Auxfiler(object):
    """Structures auxiliary file information.

    To save some parameter information to auxiliary files, it is advisable
    to prepare (only) one |Auxfiler| object:

    >>> from hydpy import Auxfiler
    >>> aux = Auxfiler()

    Each |Auxfiler| object is capable of handling parameter
    information for different kinds of models and performs some plausibility
    checks on added data.  Assume, we want to store the control files of
    a "LARSIM type" HydPy project involving the application models |lland_v1|,
    |lland_v2| and |lstream_v1|.  The following example shows, that these
    models can be added to the |Auxfiler| object by passing their module
    (|lland_v1|), a working model object (|lland_v2|) or their name
    (|lstream_v1|):


    >>> from hydpy import prepare_model
    >>> from hydpy.models import lland_v1 as module
    >>> from hydpy.models import lland_v2
    >>> model = prepare_model(lland_v2)
    >>> string = 'lstream_v1'

    All new model types can be added individually or in groups using the
    `+=` operator:

    >>> aux += module
    >>> aux += model, string
    >>> aux
    Auxfiler(lland_v1, lland_v2, lstream_v1)

    Wrong model specifications result in errors like the following one:

    >>> aux += 'asdf'   # doctest: +SKIP
    Traceback (most recent call last):
    ...
    ModuleNotFoundError: While trying to add one ore more models to the \
actual auxiliary file handler, the following error occured: \
While trying to import a model named `asdf`, the following error occured: \
No module named `hydpy.models.asdf`.

    .. testsetup::

        >>> try:
        ...     aux += 'asdf'
        ... except ImportError:
        ...     pass


    The |Auxfiler| object allocates a separate |Variable2Auxfile| object to
    each model type.  These are available via attribute reading access, but
    setting new or deleting existing |Variable2Auxfile| objects is disabled
    for safety purposes:

    >>> aux.lland_v1
    Variable2Auxfile()
    >>> aux.lland_v2 = aux.lland_v1
    Traceback (most recent call last):
    ...
    AttributeError: Auxiliary file handler do not support setting \
attributes.  Use the `+=` operator to register additional models instead.
    >>> del aux.lland_v1
    Traceback (most recent call last):
    ...
    AttributeError: Auxiliary file handler do not support deleting \
attributes.  Use the `-=` operator to remove registered models instead.

    As stated by the last error message, removing models and their
    |Variable2Auxfile| object should be done via the `-=` operator:

    >>> aux -= module, string
    >>> aux
    Auxfiler(lland_v2)

    The handling of the individual |Variable2Auxfile| objects is
    explained below.  But there are some additional plausibility checks,
    which require that these objects are contained by a single master
    |Auxfiler| object.  For demonstration, the removed models are added again:

    >>> aux += module, string

    The first plausibility check is for duplicate filenames:

    >>> model.parameters.control.eqd1(200.0)
    >>> aux.lland_v1.file1 = model.parameters.control.eqd1
    >>> model.parameters.control.eqd2(100.0)
    >>> aux.lland_v2.file1 = model.parameters.control.eqd2
    Traceback (most recent call last):
    ...
    ValueError: While trying to extend the range of variables handled \
by the actual Variable2AuxFile object, the following error occured: \
Filename `file1` is already allocated to another `Variable2Auxfile` object.
    >>> aux.lland_v2.file2 = model.parameters.control.eqd2

    Secondly, it is checked if an assigned parameter actually belongs
    to the corresponding model:

    >>> aux.lstream_v1.file3 = model.parameters.control.eqd1
    Traceback (most recent call last):
    ...
    TypeError: While trying to extend the range of variables handled \
by the actual Variable2AuxFile object, the following error occured: \
Variable type `EQD1` is not handled by model `lstream_v1`.
    >>> aux.lland_v2.file2 = model.parameters.control.eqd1

    The |Auxfiler| object defined above is also used in the documentation
    of the following class members.  Hence it is stored in the |Dummies|
    object:

    >>> from hydpy import dummies
    >>> dummies.aux = aux
    """
    def __init__(self):
        with objecttools.ResetAttrFuncs(self):
            self._dict = {}

    def __iadd__(self, values):
        try:
            for model in self._get_models(values):
                self._dict[str(model)] = Variable2Auxfile(
                    _master=self, _model=model)
            return self
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to add one ore more models '
                'to the actual auxiliary file handler')

    def __isub__(self, values):
        try:
            for model in self._get_models(values):
                try:
                    del self._dict[str(model)]
                except KeyError:
                    raise AttributeError(
                        'The handler does not contain model `%s`.'
                        % model)
            return self
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to remove one or more models '
                'from the actual auxiliary file handler')

    @staticmethod
    def _get_models(values):
        for value in objecttools.extract(
                values, (str, types.ModuleType, abctools.ModelABC)):
            yield Auxfiler._get_model(value)

    @staticmethod
    def _get_model(value):
        if isinstance(value, str):
            try:
                value = importlib.import_module('hydpy.models.'+value)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to import a model named `%s`'
                    % value)
        if isinstance(value, types.ModuleType):
            try:
                value = importtools.prepare_model(value)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to prepare the model defined in'
                    'module `hydpy.models.%s`'
                    % objecttools.modulename(value))
        return value

    def __getattr__(self, name):
        try:
            return self._dict[name]
        except KeyError:
            raise AttributeError(
                'The actual auxiliary file handler does neither have a '
                'standard member nor does it handle a model named `%s`.'
                % name)

    def __setattr__(self, name, value):
        raise AttributeError(
            'Auxiliary file handler do not support setting attributes.  '
            'Use the `+=` operator to register additional models instead.')

    def __delattr__(self, name):
        raise AttributeError(
            'Auxiliary file handler do not support deleting attributes.  '
            'Use the `-=` operator to remove registered models instead.')

    def __iter__(self):
        for (key, value) in sorted(self._dict.items()):
            yield (key, value)

    @property
    def modelnames(self):
        """A sorted list of all names of the handled models.

        >>> from hydpy import dummies
        >>> dummies.aux.modelnames
        ['lland_v1', 'lland_v2', 'lstream_v1']
    """
        return sorted(self._dict.keys())

    def save(self, parameterstep=None, simulationstep=None):
        """Save all defined auxiliary control files.

        The target path is taken from the |ControlManager| object stored
        in module |pub|.  Hence we initialize one and overwrite its
        |property| `currentpath` with a simple |str| object defining the
        test target path:

        >>> from hydpy import pub
        >>> pub.projectname = 'test'
        >>> from hydpy.core.filetools import ControlManager
        >>> ControlManager.currentpath = 'test_directory'
        >>> pub.controlmanager = ControlManager()

        Normally, the control files would be written to disk, of course.
        But to show (and test) the results in the following doctest,
        file writing is temporarily redirected via |Open|:

        >>> from hydpy import dummies
        >>> from hydpy import Open
        >>> with Open():
        ...     dummies.aux.save(
        ...         parameterstep='1d',
        ...         simulationstep='12h')
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        test_directory/file1.py
        -----------------------------------
        # -*- coding: utf-8 -*-
        <BLANKLINE>
        from hydpy.models.lland_v1 import *
        <BLANKLINE>
        simulationstep("12h")
        parameterstep("1d")
        <BLANKLINE>
        eqd1(200.0)
        <BLANKLINE>
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        test_directory/file2.py
        -----------------------------------
        # -*- coding: utf-8 -*-
        <BLANKLINE>
        from hydpy.models.lland_v2 import *
        <BLANKLINE>
        simulationstep("12h")
        parameterstep("1d")
        <BLANKLINE>
        eqd1(200.0)
        eqd2(100.0)
        <BLANKLINE>
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        """
        par = parametertools.Parameter
        if not parameterstep:
            parameterstep = par.parameterstep
        if not simulationstep:
            simulationstep = par.simulationstep
        for (modelname, var2aux) in self:
            for filename in var2aux.filenames:
                with par.parameterstep(parameterstep), \
                         par.simulationstep(simulationstep):
                    lines = [parametertools.header_controlfile(
                        modelname, parameterstep, simulationstep)]
                    for par in getattr(var2aux, filename):
                        lines.append(repr(par) + '\n')
                pub.controlmanager.save_file(filename, ''.join(lines))

    __copy__ = objecttools.copy_

    __deepcopy__ = objecttools.deepcopy_

    def __repr__(self):
        return objecttools.assignrepr_values(
            self.modelnames, 'Auxfiler(', width=70) + ')'

    def __dir__(self):
        """
        >>> from hydpy import print_values
        >>> aux = Auxfiler()
        >>> aux += 'llake_v1', 'lland_v1', 'lstream_v1'
        >>> print_values(dir(aux))
        llake_v1, lland_v1, lstream_v1, modelnames, save
        """
        return objecttools.dir_(self) + self.modelnames


class Variable2Auxfile(object):
    """Map |Variable| objects to names of auxiliary files.

    Normally, |Variable2Auxfile| object are not initialized by the
    user explicitly but made available by a `master` |Auxfiler| object.

    To show how |Variable2Auxfile| works, we firstly initialize a
    HydPy-L-Land (version 1) model:

    >>> from hydpy import pub
    >>> pub.options.usedefaultvalues = True
    >>> from hydpy.models.lland_v1 import *
    >>> simulationstep('1d')
    >>> parameterstep('1d')

    Note that we made use of the `usedefaultvalues` option.
    Hence, all parameters used in the following examples have
    some predefined values, e.g.:

    >>> eqb
    eqb(5000.0)

    Next, we initialize a |Variable2Auxfile| object, which is supposed
    to allocate some calibration parameters related to runoff
    concentration to two axiliary files named `file1` and `file2`:

    >>> from hydpy.core.auxfiletools import Variable2Auxfile
    >>> v2af = Variable2Auxfile()

    Auxiliary file `file1` shall contain the actual values of parameters
    `eqb`, `eqi1` and `eqi2`:

    >>> v2af.file1 = eqb
    >>> v2af.file1 = eqi1, eqi2
    >>> v2af.file1
    [eqb(5000.0), eqi1(2000.0), eqi2(1000.0)]

    Auxiliary file `file2` shall contain the actual values of parameters
    `eqd1`, `eqd2` and (also!) of parameter `eqb`:

    >>> v2af.file2 = eqd1, eqd2
    >>> v2af.file2 = eqb
    Traceback (most recent call last):
    ...
    ValueError: While trying to extend the range of variables handled by the \
actual Variable2AuxFile object, the following error occured: You tried to \
allocate variable `eqb(5000.0)` to filename `file2`, but an equal `EQB` \
object has already been allocated to filename `file1`.
    >>> v2af.file2
    [eqd1(100.0), eqd2(50.0)]

    As explained by the error message, allocating the same parameter type
    with equal values to two different auxiliary files is not allowed.
    (If you really want to store equal values of the same type of parameter
    whithin different auxiliary files, work with selections instead.)

    Nevertheless, after changing the value of parameter `eqb`, it can be
    allocated to file name `file2`:

    >>> eqb *= 2
    >>> v2af.file2 = eqb
    >>> v2af.file2
    [eqb(10000.0), eqd1(100.0), eqd2(50.0)]

    The following example shows that the value of parameter `eqb` already
    allocated to `file1` has not been changed (this safety mechanism is
    accomplished via deep copying), and that all registered parameters can
    be viewed by using their names as an attribute names:

    >>> v2af.eqb
    [eqb(5000.0), eqb(10000.0)]

    Unfortunately, the string representations of |Variable2Auxfile|
    are not executable at the moment:

    >>> v2af
    Variable2Auxfile(file1, file2)

    The |Variable2Auxfile| object defined above is also used in the
    documentation of the following class members.  Hence it is stored in
    the |Dummies| object:

    >>> from hydpy import dummies
    >>> dummies.v2af = v2af

    The explanations above focus on parameter objects only.
    |Variable2Auxfile| could be used to handle sequence objects as well,
    but possibly without a big benefit as long as `auxiliary condition
    files` are not supported.
    """

    def __init__(self, _master=None, _model=None):
        with objecttools.ResetAttrFuncs(self):
            self._master = _master
            self._model = _model
            self._type2filename2variable = {}

    def __getattr__(self, name):
        variables = self._sort_variables(self._yield_variables(name))
        if variables:
            return variables
        else:
            raise AttributeError(
                '`{0}` is neither a filename nor a name of a variable '
                'handled by the actual Variable2AuxFile object.'
                .format(name))

    def __setattr__(self, filename, variables):
        try:
            self._check_filename(filename)
            new_vars = objecttools.extract(
                variables,
                (abctools.ParameterABC, abctools.ConditionSequenceABC))
            for new_var in new_vars:
                self._check_variable(new_var)
                fn2var = self._type2filename2variable.get(type(new_var), {})
                self._check_duplicate(fn2var, new_var, filename)
                fn2var[filename] = copy.deepcopy(new_var)
                self._type2filename2variable[type(new_var)] = fn2var
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to extend the range of variables handled by '
                'the actual Variable2AuxFile object')

    def _check_filename(self, filename):
        objecttools.valid_variable_identifier(filename)
        if self._master is not None:
            for dummy, var2aux in self._master:
                if (var2aux is not self) and (filename in var2aux.filenames):
                    raise ValueError(
                        'Filename `{0}` is already allocated to '
                        'another `Variable2Auxfile` object.'
                        .format(filename))

    def _check_variable(self, variable):
        if self._model and (variable not in self._model.parameters.control):
            raise TypeError(
                'Variable type `{0}` is not handled by model `{1}`.'
                .format(objecttools.classname(variable), self._model))

    @staticmethod
    def _check_duplicate(fn2var, new_var, filename):
        for (reg_fn, reg_var) in fn2var.items():
            if (reg_fn != filename) and (reg_var == new_var):
                raise ValueError(
                    'You tried to allocate variable `{0!r}` to '
                    'filename `{1}`, but an equal `{2}` object has '
                    'already been allocated to filename `{3}`.'
                    .format(new_var, filename,
                            objecttools.classname(new_var), reg_fn))

    def remove(self, *values):
        """Remove the defined variables.

        The variables to be removed can be selected in two ways.  But the
        first example shows that passing nothing or an empty iterable to
        method |Variable2Auxfile.remove| does not remove any variable:

        >>> from hydpy import dummies
        >>> v2af = dummies.v2af
        >>> v2af.remove()
        >>> v2af.remove([])
        >>> from hydpy import print_values
        >>> print_values(v2af.filenames)
        file1, file2
        >>> print_values(v2af.variables, width=30)
        eqb(5000.0), eqb(10000.0),
        eqd1(100.0), eqd2(50.0),
        eqi1(2000.0), eqi2(1000.0)

        The first option is to pass auxiliary file names:

        >>> v2af.remove('file1')
        >>> print_values(v2af.filenames)
        file2
        >>> print_values(v2af.variables)
        eqb(10000.0), eqd1(100.0), eqd2(50.0)

        The second option is, to pass variables of the correct type
        and value:

        >>> v2af = dummies.v2af
        >>> v2af.remove(v2af.eqb[0])
        >>> print_values(v2af.filenames)
        file1, file2
        >>> print_values(v2af.variables)
        eqb(10000.0), eqd1(100.0), eqd2(50.0), eqi1(2000.0), eqi2(1000.0)

        One can pass multiple variables or iterables containing variables
        at once:

        >>> v2af = dummies.v2af
        >>> v2af.remove(v2af.eqb, v2af.eqd1, v2af.eqd2)
        >>> print_values(v2af.filenames)
        file1
        >>> print_values(v2af.variables)
        eqi1(2000.0), eqi2(1000.0)

        Passing an argument that equals neither a registered file name or a
        registered variable results in the following exception:

        >>> v2af.remove('test')
        Traceback (most recent call last):
        ...
        ValueError: While trying to remove the given object `test` of type \
`str` from the actual Variable2AuxFile object, the following error occured:  \
`'test'` is neither a registered filename nor a registered variable.
        """
        for value in objecttools.extract(values, (str, abctools.VariableABC)):
            try:
                deleted_something = False
                for fn2var in list(self._type2filename2variable.values()):
                    for fn_, var in list(fn2var.items()):
                        if value in (fn_, var):
                            del fn2var[fn_]
                            deleted_something = True
                if not deleted_something:
                    raise ValueError(
                        ' `{0!r}` is neither a registered filename nor a '
                        'registered variable.'.format(value))
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to remove the given object `{0}` of type '
                    '`{1}` from the actual Variable2AuxFile object'
                    .format(value, objecttools.classname(value)))

    @property
    def types(self):
        """A list of all handled variable types.

        >>> from hydpy import dummies
        >>> from hydpy import print_values
        >>> print_values(dummies.v2af.types, width=50)
        <class 'hydpy.models.lland.lland_control.EQB'>,
        <class 'hydpy.models.lland.lland_control.EQD1'>,
        <class 'hydpy.models.lland.lland_control.EQD2'>,
        <class 'hydpy.models.lland.lland_control.EQI1'>,
        <class 'hydpy.models.lland.lland_control.EQI2'>
        """
        return sorted(self._type2filename2variable.keys(), key=str)

    @property
    def filenames(self):
        """A list of all handled auxiliary file names.

        >>> from hydpy import dummies
        >>> dummies.v2af.filenames
        ['file1', 'file2']
        """
        fns = set()
        for fn2var in self._type2filename2variable.values():
            fns.update(fn2var.keys())
        return sorted(fns)

    @property
    def variables(self):
        """A list of all handled variable objects.

        >>> from hydpy import dummies
        >>> from hydpy import print_values
        >>> print_values(dummies.v2af.variables, width=30)
        eqb(5000.0), eqb(10000.0),
        eqd1(100.0), eqd2(50.0),
        eqi1(2000.0), eqi2(1000.0)
        """
        return self._sort_variables(self._yield_variables())

    def _yield_variables(self, name=None):
        for fn2var in self._type2filename2variable.values():
            for fn_, var in fn2var.items():
                if name in (None, fn_, var.name):
                    yield var

    @staticmethod
    def _sort_variables(variables):
        return sorted(variables, key=lambda x: (x.name, sum(x)))

    def get_filename(self, variable):
        """Return the auxiliary file name the given variable is allocated
        to or |None| if the given variable is not allocated to any
        auxiliary file name.

        >>> from hydpy import dummies
        >>> eqb = dummies.v2af.eqb[0]
        >>> dummies.v2af.get_filename(eqb)
        'file1'
        >>> eqb += 500.0
        >>> dummies.v2af.get_filename(eqb)
        """
        fn2var = self._type2filename2variable.get(type(variable), {})
        for (fn_, var) in fn2var.items():
            if var == variable:
                return fn_
        return None

    __copy__ = objecttools.copy_

    __deepcopy__ = objecttools.deepcopy_

    def __repr__(self):
        return objecttools.assignrepr_values(
            self.filenames, 'Variable2Auxfile(', width=70) + ')'

    def __dir__(self):
        """
        >>> from hydpy import dummies
        >>> from hydpy import print_values
        >>> print_values(dir(dummies.v2af))
        eqb, eqd1, eqd2, eqi1, eqi2, file1, file2, filenames, get_filename,
        remove, types, variables
        """
        return (objecttools.dir_(self) +
                self.filenames +
                [objecttools.instancename(type_) for type_ in self.types])


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/connectiontools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
# -*- coding: utf-8 -*-
"""This modules implements tools for handling connections between |Node| and
|Element| instances.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from Hydpy
from hydpy.core import autodoctools


class Connections(object):
    """Connection between |Node| and |Element| instances.
    """

    __slots__ = ('master', 'name', '_slaves')

    def __init__(self, master, name):
        self.master = master
        self.name = name
        self._slaves = set()

    def __iadd__(self, slave):
        self._slaves.add(slave)
        return self

    @property
    def names(self):
        return tuple(slave.name for slave in sorted(self._slaves))

    @property
    def slaves(self):
        return tuple(slave for slave in sorted(self._slaves))

    @property
    def variables(self):
        variable = getattr(self.master, 'variable', None)
        if variable:
            return [variable]
        else:
            return sorted(set([slave.variable for slave in self]))

    def __getattr__(self, name):
        for slave in self._slaves:
            if name == slave.name:
                return slave
        else:
            raise AttributeError(
                'The selected connection neither has a attribute nor does '
                'it handle a slave named `%s`.' % name)

    def __delattr__(self, name):
        slave = getattr(self, name)
        self._slaves.remove(slave)

    def __contains__(self, value):
        try:
            value = value.name
        except AttributeError:
            pass
        return value in self.names

    def __iter__(self):
        for slave in sorted(self._slaves):
            yield slave

    def __len__(self):
        return len(self._slaves)

    def __dir__(self):
        return ['names', 'slaves', 'variables'] + list(self.names)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/devicetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
1745  
1746  
1747  
1748  
1749  
1750  
1751  
1752  
1753  
1754  
1755  
1756  
1757  
1758  
1759  
1760  
1761  
1762  
1763  
1764  
1765  
1766  
1767  
1768  
1769  
1770  
1771  
1772  
1773  
1774  
1775  
1776  
1777  
1778  
1779  
1780  
1781  
1782  
1783  
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  
1792  
1793  
1794  
1795  
1796  
1797  
1798  
1799  
1800  
1801  
1802  
1803  
1804  
1805  
1806  
1807  
1808  
1809  
1810  
1811  
1812  
1813  
1814  
1815  
1816  
1817  
1818  
1819  
1820  
1821  
1822  
1823  
1824  
1825  
1826  
1827  
1828  
1829  
1830  
1831  
1832  
1833  
1834  
1835  
1836  
1837  
1838  
1839  
1840  
1841  
1842  
1843  
1844  
1845  
1846  
1847  
1848  
1849  
1850  
1851  
1852  
1853  
1854  
1855  
1856  
1857  
1858  
1859  
1860  
1861  
1862  
1863  
1864  
1865  
1866  
1867  
1868  
1869  
1870  
1871  
1872  
1873  
1874  
1875  
1876  
1877  
1878  
1879  
1880  
1881  
1882  
1883  
1884  
1885  
1886  
1887  
1888  
1889  
1890  
1891  
1892  
1893  
1894  
1895  
1896  
1897  
1898  
1899  
1900  
1901  
1902  
1903  
1904  
1905  
1906  
1907  
1908  
1909  
1910  
1911  
1912  
1913  
1914  
1915  
1916  
1917  
1918  
1919  
1920  
1921  
1922  
1923  
1924  
1925  
1926  
1927  
1928  
1929  
1930  
1931  
1932  
1933  
1934  
1935  
1936  
1937  
1938  
1939  
# -*- coding: utf-8 -*-
"""This modules implements features related to two types of `devices`,
called `nodes` and `elements` which are the most fundamental means to
structure HydPy projects.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import copy
import os
import struct
import warnings
import weakref
# ...from site-packages
import numpy
from hydpy import pyplot
# ...from HydPy
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import connectiontools
from hydpy.core import objecttools
from hydpy.core import printtools
from hydpy.core import sequencetools
from hydpy.cythons import pointerutils


class Keywords(set):
    """Set of keyword arguments used to describe and search for element and
    node objects.

    >>> from hydpy.core.devicetools import Keywords
    >>> from hydpy import dummies
    >>> dummies.keywords = Keywords(['first_keyword', 'second_keyword',
    ...                              'keyword_3', 'keyword_4',
    ...                              'keyboard'])
    >>> dummies.keywords
    Keywords(["first_keyword", "keyboard", "keyword_3", "keyword_4",
              "second_keyword"])
    """

    def __init__(self, names=None):
        if names is None:
            names = []
        self.device = None
        self._check_keywords(names)
        set.__init__(self, names)

    def startswith(self, name):
        """Returns a list of all keywords starting with the given string.

        >>> from hydpy import dummies
        >>> dummies.keywords.startswith('keyword')
        ['keyword_3', 'keyword_4']
        """
        return sorted(keyword for keyword in self if keyword.startswith(name))

    def endswith(self, name):
        """Returns a list of all keywords ending with the given string.

        >>> from hydpy import dummies
        >>> dummies.keywords.endswith('keyword')
        ['first_keyword', 'second_keyword']
        """
        return sorted(keyword for keyword in self if keyword.endswith(name))

    def contains(self, name):
        """Returns a list of all keywords containing the given string.

        >>> from hydpy import dummies
        >>> dummies.keywords.contains('keyword')
        ['first_keyword', 'keyword_3', 'keyword_4', 'second_keyword']
        """
        return sorted(keyword for keyword in self if name in keyword)

    def _check_keywords(self, names):
        try:
            for name in names:
                objecttools.valid_variable_identifier(name)
        except ValueError:
            objecttools.augment_excmessage(
                'While trying to add the keyword `%s` to device `%s`'
                % (name, objecttools.devicename(self)))

    def update(self, names):
        """Before updating, names are checked to be valid variable identifiers.

        >>> from hydpy import dummies
        >>> keywords = dummies.keywords
        >>> keywords.update(['test_1', 'test 2'])
        Traceback (most recent call last):
        ...
        ValueError: While trying to add the keyword `test 2` to device `?`, \
the following error occured: The given name string `test 2` does not define a \
valid variable identifier.  ...

        Note that the first string (`test_1`) is not added, as the second
        one (`test 2`) is invalid:

        >>> keywords
        Keywords(["first_keyword", "keyboard", "keyword_3", "keyword_4",
                  "second_keyword"])

        If the seconds string is corrected, everything works fine:

        >>> keywords.update(['test_1', 'test_2'])
        >>> keywords
        Keywords(["first_keyword", "keyboard", "keyword_3", "keyword_4",
                  "second_keyword", "test_1", "test_2"])
        """
        self._check_keywords(names)
        set.update(self, names)

    def add(self, name):
        """Before adding a new name, it is checked to be valid variable identifiers.

        >>> from hydpy import dummies
        >>> keywords = dummies.keywords
        >>> keywords.add('1_test')
        Traceback (most recent call last):
        ...
        ValueError: While trying to add the keyword `1_test` to device `?`, \
the following error occured: The given name string `1_test` does not define a \
valid variable identifier.  ...

        >>> keywords
        Keywords(["first_keyword", "keyboard", "keyword_3", "keyword_4",
                  "second_keyword"])

        If the string is corrected, everything works fine:

        >>> keywords.add('one_test')
        >>> keywords
        Keywords(["first_keyword", "keyboard", "keyword_3", "keyword_4",
                  "one_test", "second_keyword"])
        """
        self._check_keywords([name])
        set.add(self, name)

    def __repr__(self):
        with objecttools.repr_.preserve_strings(True):
            return objecttools.assignrepr_list(
                sorted(self), 'Keywords(', width=70) + ')'

    __dir__ = objecttools.dir_


class Device(object):
    """Base class for class |Element| and class |Node|.

    For framework programmers it is important to know, that all created
    devices are registered.  Besides some other simplifications for
    framework users, this prevents from defining multiple devices with
    the same name (which is not allowed, at the names are supposed to
    be valid object identifiers).

    To show how the registry works, we first start with a clear registry:

    >>> from hydpy import Node
    >>> Node.clear_registry()
    >>> sorted(Node.registered_names())
    []

    Now we initialize two nodes:

    >>> node1 = Node('n1')
    >>> node2 = Node('n2')

    Each time we pass the same names to the constructor of class |Node|,
    the same object is returned:

    >>> node1 is Node('n1')
    True
    >>> node1 is Node('n2')
    False

    You can access all registed nodes via the following class method:

    >>> Node.registered_nodes()
    Nodes("n1", "n2")

    The respective names are directly available via:

    >>> sorted(Node.registered_names())
    ['n1', 'n2']

    It is not recommended under usual circumstances, but you are allowed
    to clear the registry:

    >>> Node.clear_registry()
    >>> Node.registered_nodes()
    Nodes()

    But now there is the danger of creating two differnt nodes with the
    same name, which is very likely to result in strange bugs:

    >>> new_node1 = Node('n1')
    >>> new_node1 is node1
    False
    >>> new_node1 == node1
    True

    The examples above also work for class |Element|, except that method
    |Node.registered_nodes| must be exchanged with method
    |Element.registered_elements|, of course:

    >>> from hydpy import Element
    >>> Element.clear_registry()
    >>> Element('e1').registered_elements()
    Elements("e1")
    """

    _registry = {}
    _selection = {}

    def _get_name(self):
        """Name of the actual device (node or element).

        Names are the identifiers of |Node| and |Element| objects.
        So define them carefully:

        >>> from hydpy import Node
        >>> node1, node2 = Node('n1'), Node('n2')
        >>> node1 is Node('n1')
        True
        >>> node1 is Node('n2')
        False

        Note that each name name must be a valid variable identifier (see
        function |valid_variable_identifier|), to allow for attribute access:

        >>> from hydpy import Nodes
        >>> nodes = Nodes(node1, 'n2')
        >>> nodes.n1
        Node("n1", variable="Q")

        Invalid variable identifiers result errors like the following:

        >>> node3 = Node('n 3')
        Traceback (most recent call last):
        ...
        ValueError: While trying to initialize a `Node` object with value \
`n 3` of type `str`, the following error occured: The given name string `n 3` \
does not define a valid variable identifier.  ...

        When you change the name of a |Node| and |Element| object (only
        do this for a good reason), the corresponding key of all related
        |Nodes| and |Elements| objects (as well as of the internal registry)
        changes automatically:

        >>> node1.name = 'n1a'
        >>> nodes
        Nodes("n1a", "n2")
        """
        return self._name

    def _set_name(self, name):
        self._check_name(name)
        _handlers = self._handlers.copy()
        for handler in _handlers:
            handler.remove_device(self)
        try:
            del self._registry[self._name]
        except KeyError:
            pass
        else:
            self._registry[name] = self
        self._name = name
        for handler in _handlers:
            handler.add_device(self)

    name = property(_get_name, _set_name)

    def _check_name(self, name):
        try:
            objecttools.valid_variable_identifier(name)
        except ValueError:
            objecttools.augment_excmessage(
                'While trying to initialize a `%s` object with value `%s` '
                'of type `%s`' % (objecttools.classname(self), name,
                                  objecttools.classname(name)))

    def _get_keywords(self):
        """Keywords describing this device.

        The keywords are contained within a |Keywords| object:

        >>> from hydpy import Node
        >>> node = Node('n')
        >>> node.keywords
        Keywords([])

        You are allowed to add then individually...

        >>> node.keywords = 'word1'

        ... or within iterables:

        >>> node.keywords = ('word2', 'word3')
        >>> node.keywords
        Keywords(["word1", "word2", "word3"])

        You can delete all keywords at once via:

        >>> del node.keywords
        >>> node.keywords
        Keywords([])
        """
        return self._keywords

    def _set_keywords(self, keywords):
        keywords = tuple(objecttools.extract(keywords, (str,), True))
        self._keywords.update(keywords)

    def _del_keywords(self):
        self._keywords.clear()

    keywords = property(_get_keywords, _set_keywords, _del_keywords)

    @classmethod
    def clear_registry(cls):
        """Clear the registry from all initialized devices."""
        cls._selection.clear()
        cls._registry.clear()

    @classmethod
    def registered_names(cls):
        """Get all names of |Device| objects initialized so far."""
        return cls._registry.keys()

    def add_handler(self, handler):
        """Add the given handler (either an |Elements| or
        :class`Nodes` object) to the set of handlers stored internally."""
        self._handlers.add(handler)

    def remove_handler(self, handler):
        """Remove the given handler (either an |Elements| or
        :class`Nodes` object) from the set of handlers stored internally."""
        self._handlers.remove(handler)

    def __iter__(self):
        for connections in self._all_connections:
            yield connections

    def __lt__(self, other):
        return self.name < other.name

    def __le__(self, other):
        return self.name <= other.name

    def __eq__(self, other):
        return self.name == other.name

    def __ne__(self, other):
        return self.name != other.name

    def __ge__(self, other):
        return self.name >= other.name

    def __gt__(self, other):
        return self.name > other.name

    def __hash__(self):
        return id(self)

    def __str__(self):
        return self.name

    __dir__ = objecttools.dir_


class Node(Device):
    """Handles the data flow between |Element| objects.

    When initializing |Node| objects, values for the optional `variable`
    and `keywords` can be passed, which default to `Q` and "empty:

    >>> from hydpy import Node
    >>> node = Node('test')
    >>> node.variable
    'Q'
    >>> node.keywords
    Keywords([])

    You are allowed to add further keywords by successive constructor calls:

    >>> node = Node('test', keywords='word1')
    >>> Node('test', keywords=('word2', 'word3'))
    Node("test", variable="Q",
         keywords=["word1", "word2", "word3"])

    But you are not allowed to change the variable a node is supposed to
    handle (would be to error-prone):

    >>> Node('test', variable='W')
    Traceback (most recent call last):
    ...
    ValueError: The variable to be represented by a `Node instance cannot \
be changed.  The variable of node `test` is `Q` instead of `W` or `None`.  \
Keep in mind, that `name` is the unique identifier of node objects.

    If you really want to change a variable without to restart your Python
    process, you have to delete the node from the registry first (again,
    very error-prone unless you are absolutely sure you can delete all
    other relevant references to the node object):

    >>> del node._registry['test']
    >>> Node('test', variable='W')
    Node("test", variable="W")


    To fully understand the last example, read the technical remarks
    regarding the registry of |Device| objects explained above.
    On top of this persistent registry, there is also a temporal one,
    which helps to identify when certain nodes where created
    (e.g. during the execution of a certain network file).

    To show how this works, we again start with a clear registry:

    >>> Node.clear_registry()

    Firstly, create two nodes:

    >>> node1 = Node('n1')
    >>> node2 = Node('n2')

    Now "gather" these two nodes:

    >>> Node.gather_new_nodes()
    Nodes("n1", "n2")

    This automatically removes the gathered nodes from the temporal registry.
    This can be shown by simply calling the method again:

    >>> Node.gather_new_nodes()
    Nodes()

    Now create a new node (n3) and call the constructor of an already existing
    node again:

    >>> node3 = Node('n3')
    >>> node1 = Node('n1')

    Calling method `gather_new_nodes` again shows that an node is regarded
    as "new", if its constructor has been called:

    >>> Node.gather_new_nodes()
    Nodes("n1", "n3")

    This mechanism allows for redefining the same node in different network
    files while keeping track of all files where it has been defined.

    The following example is just supposed to clarify that the permanent
    registry has not been altered by calling `gather_new_nodes`:

    >>> Node.registered_nodes()
    Nodes("n1", "n2", "n3")
    """
    _registry = {}
    _selection = {}
    _predefinedvariable = 'Q'

    def __new__(cls, value, variable=None, keywords=None):
        """Return an already existing |Node| instance or, if such
        an instance does not exist yet, return a newly created one.
        """
        name = str(value)
        if name not in cls._registry:
            self = object.__new__(Node)
            self._check_name(name)
            self._name = name
            if variable is None:
                self._variable = self._predefinedvariable
            else:
                self._variable = variable
            self._keywords = Keywords()
            self._keywords.device = self
            self.entries = connectiontools.Connections(self, 'entries')
            self.exits = connectiontools.Connections(self, 'exits')
            self._all_connections = (self.entries, self.exits)
            self.sequences = sequencetools.NodeSequences(self)
            self.deploymode = 'newsim'
            self._blackhole = None
            self._handlers = weakref.WeakSet()
            cls._registry[name] = self
        cls._selection[name] = cls._registry[name]
        return cls._registry[name]

    def __init__(self, name, variable=None, keywords=None):
        if (variable is not None) and (variable != self.variable):
            raise ValueError(
                'The variable to be represented by a `Node instance cannot be '
                'changed.  The variable of node `%s` is `%s` instead of `%s` '
                'or `None`.  Keep in mind, that `name` is the unique '
                'identifier of node objects.'
                % (self.name, self.variable, variable))
        self.keywords = keywords

    @property
    def variable(self):
        """The variable handled by the respective node instance, e.g. `Q`."""
        return self._variable

    @classmethod
    def registered_nodes(cls):
        """Get all |Node| objects initialized so far."""
        return Nodes(cls._registry.values())

    @classmethod
    def gather_new_nodes(cls):
        """Gather all `new` |Node| objects. |Node| objects
        are deemed to be new if they have been created after the last usage
        of this method.
        """
        nodes = Nodes(cls._selection.values())
        cls._selection.clear()
        return nodes

    def _get_deploymode(self):
        """Defines the kind of information a node deploys.

        The following modes are supported:

          * newsim: Deploy the simulated values calculated just recently.
            This is the default mode, where a node receives e.g. a discharge
            value from a upstream element and passes it to the downstream
            element directly.
          * obs: Deploy observed values instead of simulated values.  The
            node still receives the simulated values from its upstream
            element(s).  But it deploys values to its downstream nodes which
            are defined externally.  Usually, these values are observations
            made available within an Sequence file. See module
            |sequencetools| for further information on file specifications.
          * oldsim: Simular to mode `obs`.  But it is usually applied when
            a node is supposed to deploy simulated values which have been
            calculated in a previous simulation run and stored in a sequence
            file.

        The technical difference between modes `obs` and `oldsim` is, that
        the external values are either handled by the `obs` or the `sim`
        sequence object.  Hence, if you select the `oldsim` mode, the
        values of the upstream elements calculated within the current
        simulation are not available (e.g. for parameter calibration)
        after the simulation is finished.
        """
        return self._deploymode

    def _set_deploymode(self, value):
        if value == 'newsim':
            self.sequences.sim.use_ext = False
        elif value == 'obs':
            self.sequences.sim.use_ext = False
            self.sequences.obs.use_ext = True
        elif value == 'oldsim':
            self.sequences.sim.use_ext = True
            self._blackhole = pointerutils.Double(0.)
        else:
            raise ValueError(
                'When trying to set the routing mode of node %s, the value '
                '`%s` was given, but only the following values are allowed: '
                '`newsim`, `obs` and `oldsim`.' % (self.name, value))
        self._deploymode = value

    deploymode = property(_get_deploymode, _set_deploymode)

    def get_double(self, group):
        """Return the |Double| object appropriate for the given group and
        the predefined deploy mode.

        >>> from hydpy import Node
        >>> node = Node('node1')
        >>> node.sequences.sim = 1.0
        >>> node.sequences.obs = 2.0
        >>> def test(deploymode):
        ...     node.deploymode = deploymode
        ...     for group in ('inlets', 'receivers', 'outlets', 'senders'):
        ...         print(node.get_double(group), end='')
        ...         if group != 'senders':
        ...             print(end=' ')
        >>> test('newsim')
        1.0 1.0 1.0 1.0
        >>> test('obs')
        2.0 2.0 1.0 1.0
        >>> test('oldsim')
        1.0 1.0 0.0 0.0
        >>> node.get_double('test')
        Traceback (most recent call last):
        ...
        ValueError: Function `get_double` of class `Node` does not support \
the given group name `test`.
        """
        if group in ('inlets', 'receivers'):
            return self.get_double_via_exits()
        elif group in ('outlets', 'senders'):
            return self.get_double_via_entries()
        raise ValueError(
            'Function `get_double` of class `Node` does not '
            'support the given group name `%s`.' % group)

    def get_double_via_exits(self):
        """Return the |Double| object that is supposed to deploy its value
        to the downstream elements."""
        if self.deploymode != 'obs':
            return self.sequences.fastaccess.sim
        return self.sequences.fastaccess.obs

    def get_double_via_entries(self):
        """Return the |Double| object that is supposed to receive the
        value(s) of the upstream elements."""
        if self.deploymode != 'oldsim':
            return self.sequences.fastaccess.sim
        return self._blackhole

    def reset(self, idx=None):
        """Reset the actual value of the simulation sequence to zero."""
        self.sequences.fastaccess.sim[0] = 0.

    def open_files(self, idx=0):
        """Call method |Sequences.open_files| of the |Sequences| object
        handled (indirectly) by the actual |Node| object."""
        self.sequences.open_files(idx)

    def close_files(self):
        """Call method |Sequences.close_files| of the |Sequences| object
        handled (indirectly) by the actual |Node| object."""
        self.sequences.close_files()

    def _load_data_sim(self, idx):
        """Load the next sim sequence value (of the given index).

        Used during simulations in Python mode only.
        """
        fastaccess = self.sequences.fastaccess
        if fastaccess._sim_ramflag:
            fastaccess.sim[0] = fastaccess._sim_array[idx]
        elif fastaccess._sim_diskflag:
            raw = fastaccess._sim_file.read(8)
            fastaccess.sim[0] = struct.unpack('d', raw)

    def _save_data_sim(self, idx):
        """Save the last sim sequence value (of the given index).

        Used during simulations in Python mode only.
        """
        fastaccess = self.sequences.fastaccess
        if fastaccess._sim_ramflag:
            fastaccess._sim_array[idx] = fastaccess.sim[0]
        elif fastaccess._sim_diskflag:
            raw = struct.pack('d', fastaccess.sim[0])
            fastaccess._sim_file.write(raw)

    def _load_data_obs(self, idx):
        """Load the next obs sequence value (of the given index).

        Used during simulations in Python mode only.
        """
        fastaccess = self.sequences.fastaccess
        if fastaccess._obs_ramflag:
            fastaccess.obs[0] = fastaccess._obs_array[idx]
        elif fastaccess._obs_diskflag:
            raw = fastaccess._obs_file.read(8)
            fastaccess.obs[0] = struct.unpack('d', raw)

    def prepare_allseries(self, ramflag=True):
        """Prepare the series objects of both the `sim` and the `obs` sequence.

        Call this method before a simulation run, if you need access to the
        whole time series of the simulated and the observed series after the
        simulation run is finished.

        By default, the series are stored in RAM, which is the faster
        option.  If your RAM is limited, pass the `False` for function
        argument `ramflag` to store the series on disk.
        """
        self.prepare_simseries(ramflag)
        self.prepare_obsseries(ramflag)

    def prepare_simseries(self, ramflag=True):
        """Prepare the series object of the `sim` sequence.

        See method |Node.prepare_allseries| for further information.
        """
        self._prepare_nodeseries('sim', ramflag)

    def prepare_obsseries(self, ramflag=True):
        """Prepare the series object of the `obs` sequence.

        See method |Node.prepare_allseries| for further information.
        """
        self._prepare_nodeseries('obs', ramflag)

    def _prepare_nodeseries(self, seqname, ramflag):
        seq = getattr(self.sequences, seqname)
        if ramflag:
            seq.activate_ram()
        else:
            seq.activate_disk()

    def plot_allseries(self, **kwargs):
        """Plot the series of both the `sim` and (if available) the `obs`
        sequence."""
        for seq in self.sequences:
            if pyplot.isinteractive():
                name = ' '.join((self.name, seq.name))
            pyplot.plot(seq.series, label=name, **kwargs)
        pyplot.legend()
        variable = self.variable
        if variable == 'Q':
            variable = u'Q [m³/s]'
        pyplot.ylabel(variable)
        if not pyplot.isinteractive():
            pyplot.show()

    @staticmethod
    def _calc_idxs(values):
        return ~numpy.isnan(values) * ~numpy.isinf(values)

    def violinplot(self, logscale=True):
        old_settings = numpy.seterr(divide='ignore')
        try:
            sim = self.sequences.sim
            obs = self.sequences.obs
            if not (sim.memoryflag or obs.memoryflag):
                raise RuntimeError(
                    'neither sim nor obs')
            if sim.memoryflag:
                sim_values = sim.series
                if logscale:
                    sim_values = numpy.log10(sim_values)
            if obs.memoryflag:
                obs_values = obs.series
                if logscale:
                    obs_values = numpy.log10(obs_values)
            if sim.memoryflag and obs.memoryflag:
                idxs = self._calc_idxs(sim_values)*self._calc_idxs(obs_values)
                data = (sim_values[idxs], obs_values[idxs])
                pyplot.xticks([1, 2], ['sim', 'obs'])
            elif sim.memoryflag:
                idxs = self._calc_idxs(sim_values)
                data = sim_values[idxs]
                pyplot.xticks([1], ['sim'])
            else:
                idxs = self._calc_idxs(obs_values)
                data = obs_values[idxs]
                pyplot.xticks([1], ['obs'])
            if logscale:
                points = 100
            else:
                points = min(max(int(numpy.sum(idxs)/10), 100), 1000)
            pyplot.violinplot(data, showmeans=True, widths=0.8, points=points)
            pyplot.title(self.name)
            if logscale:
                ticks, labels = pyplot.yticks()
                pyplot.yticks(ticks, ['%.1e' % 10**tick for tick in ticks])
            variable = self.variable
            pyplot.subplots_adjust(left=.2)
            if variable == 'Q':
                variable = u'Q [m³/s]'
            pyplot.ylabel(variable)
            if not pyplot.isinteractive():
                pyplot.show()
        finally:
            numpy.seterr(**old_settings)

    def __repr__(self):
        return self.assignrepr()

    def assignrepr(self, prefix=''):
        """Defines the `visual appearence` of |Node| objects.

        You can pass a string which prefixes the string representation.
        """
        lines = ['%sNode("%s", variable="%s",'
                 % (prefix, self.name, self.variable)]
        if self.keywords:
            subprefix = '%skeywords=' % (' '*(len(prefix)+5))
            with objecttools.repr_.preserve_strings(True):
                with objecttools.assignrepr_tuple.always_bracketed(False):
                    line = objecttools.assignrepr_list(
                        sorted(self.keywords), subprefix, width=70)
            lines.append(line + ',')
        lines[-1] = lines[-1][:-1]+')'
        return '\n'.join(lines)


abctools.NodeABC.register(Node)


class Element(Device):
    """Handles a |Model| and connects it to other models via |Node| objects.

    You are allowed to pass keywords to the constructor of class |Element|,
    as shown above for class |Node|.

    Additionally, you are allowed to pass different nodes (or names of
    nodes) by successive constructor calls, e.g.:

    >>> from hydpy import Element, Node
    >>> Element('test')
    Element("test")
    >>> Element('test',
    ...         inlets='in1',
    ...         outlets='out1',
    ...         receivers='rec1',
    ...         senders='sen1')
    Element("test",
            inlets="in1",
            outlets="out1",
            receivers="rec1",
            senders="sen1")
    >>> Element('test',
    ...         inlets=('in2', Node('in3')),
    ...         outlets=('out2', Node('out3')),
    ...         receivers=('rec2', Node('rec3')),
    ...         senders=('sen2', Node('sen3')))
    Element("test",
            inlets=["in1", "in2", "in3"],
            outlets=["out1", "out2", "out3"],
            receivers=["rec1", "rec2", "rec3"],
            senders=["sen1", "sen2", "sen3"])

    Reassigning some nodes does no harm:

    >>> Element('test',
    ...         inlets=('in2', Node('in3'), 'in4'),
    ...         outlets=('out2', Node('out3'), 'out4'),
    ...         receivers=('rec2', Node('rec3'), 'rec4'),
    ...         senders=('sen2', Node('sen3'), 'sen4'))
    Element("test",
            inlets=["in1", "in2", "in3", "in4"],
            outlets=["out1", "out2", "out3", "out4"],
            receivers=["rec1", "rec2", "rec3", "rec4"],
            senders=["sen1", "sen2", "sen3", "sen4"])

    But it is verified that an element does not handle the same node as
    an `input` and `output` node or as a `receiver` and a `sender` node:

    >>> Element('test', inlets='out1')
    Traceback (most recent call last):
    ...
    ValueError: For element `test`, the given inlet node `out1` is already \
defined as an outlet node, which is not allowed.

    >>> Element('test', outlets='in1')
    Traceback (most recent call last):
    ...
    ValueError: For element `test`, the given outlet node `in1` is already \
defined as an inlet node, which is not allowed.

    >>> Element('test', receivers='sen1')
    Traceback (most recent call last):
    ...
    ValueError: For element `test`, the given receiver node `sen1` is already \
defined as a sender node, which is not allowed.

    >>> Element('test', senders='rec1')
    Traceback (most recent call last):
    ...
    ValueError: For element `test`, the given sender node `rec1` is already \
defined as a receiver, node which is not allowed.



    Note the technical remarks regarding the permanent registry of
    |Device| objects explained above (which also help to understand
    how the last examples work behind the scenes.)  Additionally, the
    remarks on the temperal registry of |Node| objects also apply
    on |Element| objects.  Without to repeat the whole explanation,
    this can be shown by the following short example:

    >>> from hydpy import Elements
    >>> Element.clear_registry()
    >>> Elements('e1', 'e2').e1.gather_new_elements()
    Elements("e1", "e2")
    >>> Elements('e3', 'e1').e1.gather_new_elements()
    Elements("e1", "e3")
    >>> Element.gather_new_elements()
    Elements()
    >>> Element.registered_elements()
    Elements("e1", "e2", "e3")
    """

    _registry = {}
    _selection = {}

    def __new__(cls, value, inlets=None, outlets=None,
                receivers=None, senders=None, keywords=None):
        """Return an already existing |Element| instance or, if such
        an instance does not exist yet, a new newly created one.
        """
        name = str(value)
        if name not in cls._registry:
            self = object.__new__(Element)
            self._check_name(name)
            self._name = name
            self.inlets = connectiontools.Connections(self, 'inlets')
            self.outlets = connectiontools.Connections(self, 'outlets')
            self.receivers = connectiontools.Connections(self, 'receivers')
            self.senders = connectiontools.Connections(self, 'senders')
            self._all_connections = (self.inlets, self.outlets,
                                     self.receivers, self.senders)
            self._keywords = Keywords()
            self._keywords.device = self
            self.model = None
            self._handlers = weakref.WeakSet()
            cls._registry[name] = self
        cls._selection[name] = cls._registry[name]
        return cls._registry[name]

    def __init__(self, name, inlets=None, outlets=None,
                 receivers=None, senders=None, keywords=None):
        """Add the given |Node| objects via the corresponding |Connection|
        objects."""
        if inlets is not None:
            for inlet in Nodes(inlets):
                if inlet in self.outlets:
                    raise ValueError(
                        'For element `%s`, the given inlet node `%s` is '
                        'already defined as an outlet node, which is not '
                        'allowed.' % (self, inlet))
                self.inlets += inlet
                inlet.exits += self
        if outlets is not None:
            for outlet in Nodes(outlets):
                if outlet in self.inlets:
                    raise ValueError(
                        'For element `%s`, the given outlet node `%s` is '
                        'already defined as an inlet node, which is not '
                        'allowed.' % (self, outlet))
                self.outlets += outlet
                outlet.entries += self
        if receivers is not None:
            for receiver in Nodes(receivers):
                if receiver in self.senders:
                    raise ValueError(
                        'For element `%s`, the given receiver node `%s` is '
                        'already defined as a sender node, which is not '
                        'allowed.' % (self, receiver))
                self.receivers += receiver
                receiver.exits += self
        if senders is not None:
            for sender in Nodes(senders):
                if sender in self.receivers:
                    raise ValueError(
                        'For element `%s`, the given sender node `%s` is '
                        'already defined as a receiver, node which is not '
                        'allowed.' % (self, sender))
                self.senders += sender
                sender.entries += self
        self.keywords = keywords

    @classmethod
    def registered_elements(cls):
        """Get all |Element| objects initialized so far."""
        return Elements(cls._registry.values())

    @classmethod
    def gather_new_elements(cls):
        """Gather all `new` |Element| objects. |Element| objects are
        deemed to be new if they have been created after the last usage
        of this method.
        """
        elements = Elements(cls._selection.values())
        cls._selection.clear()
        return elements

    @property
    def variables(self):
        """A set of all different variables of the nodes directly connected
        to this element.

        Suppose there is a element connected to five nodes, which (partly)
        represent different variables:

        >>> from hydpy import Element, Node
        >>> element = Element('Test',
        ...                   inlets=(Node('N1', 'X'), Node('N2', 'Y1')),
        ...                   outlets=(Node('N3', 'X'), Node('N4', 'Y2')),
        ...                   receivers=(Node('N5', 'X'), Node('N6', 'Y3')),
        ...                   senders=(Node('N7', 'X'), Node('N8', 'Y4')))

        `variables` puts all the different variables of these nodes together:

        >>> sorted(element.variables)
        ['X', 'Y1', 'Y2', 'Y3', 'Y4']
        """
        variables = set()
        for connections in self:
            variables.update(connections.variables)
        return variables

    def init_model(self, clear_registry=True):
        """Load the control file of the actual |Element| object, initialize
        its |Model| object and build the required connections."""
        info = pub.controlmanager.load_file(
            element=self, clear_registry=clear_registry)
        self.connect(info['model'])

    def connect(self, model=None):
        """Connect the handled |Model| with the actual |Element| object.

        The following examples involve an error that is catched cleanly
        only in pure Python mode, hence Cython is disabled:

        >>> from hydpy import pub
        >>> pub.options.usecython = False

        If a model is passed, proper connections with this model are build
        We use the "HBV branch model" |hbranch| as an  example, which
        branches a single input value (from to node `inp`) to multiple
        outputs (nodes `out1` and `out2`):

        >>> from hydpy import Element, Node
        >>> element = Element('a_branch',
        ...                   inlets='branch_input',
        ...                   outlets=('branch_output_1', 'branch_output_2'))
        >>> inp = element.inlets.branch_input
        >>> out1, out2 = element.outlets
        >>> from hydpy.models.hbranch import *
        >>> parameterstep()
        >>> element.connect(model)

        To show that the inlet connection is built properly, assign a new
        value to the inlet node and verify that his value can actually be
        picked by the model:

        >>> inp.sequences.sim = 999.0
        >>> model.pick_input()
        >>> fluxes.input
        input(999.0)

        If no model is passed to method `connect`, the connections with
        the model already handled by this element are refreshed.  In the
        given example, the `hbranch` model could already le to connected
        to its inlet node, but not to its outlet nodes, which requires
        some parameter information on how to allocate the inflow to the
        different outlet nodes:

        >>> xpoints(0.0, 3.0)
        >>> ypoints(branch_output_1=[0.0, 1.0], branch_output_2=[0.0, 2.0])
        >>> parameters.update()
        >>> model.doit(0)
        Traceback (most recent call last):
        ...
        RuntimeError: The pointer of the acutal `PPDouble` instance at \
index 0 requested, but not prepared yet via `set_pointer`.

        The last command resulted in a somewhat strange error message.  The
        reason for the explained error is that the `hbranch` model does now
        know how to connect to the outlet nodes `out1` and `out2`, but has
        not been requested to do so.  When we do so, no error is raised:

        >>> element.connect()
        >>> parameters.update()
        >>> model.doit(0)

        Now we can prove that both the inlet and the outlet connections are
        build properly by verifying that the expected output values are
        actually passed to the outlet nodes while performing an simulation
        step with method `doit` above:

        >>> out1.sequences.sim
        sim(333.0)
        >>> out2.sequences.sim
        sim(666.0)


        If neither a model is passed nor an model is already handled, an
        erro is raised:

        >>> Element('empty').connect()
        Traceback (most recent call last):
        ...
        AttributeError: While trying to build the connections of the model \
handled by element `empty`, the following error occured: No model has been \
assigned to the element so far.
        """
        if model is not None:
            self.model = model
            model.element = self
        try:
            model = getattr(self, 'model', None)
            if model is None:
                raise AttributeError(
                    'No model has been assigned to the element so far.')
            else:
                self.model.connect()
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to build the connections of the model handled '
                'by element `%s`' % self.name)

    def open_files(self, idx=0):
        """Call method |Sequences.open_files| of the |Sequences| object
        handled (indirectly) by the actual |Element| object."""
        self.model.sequences.open_files(idx)

    def close_files(self):
        """Call method |Sequences.close_files| of the |Sequences| object
        handled (indirectly) by the actual |Element| object."""
        self.model.sequences.close_files()

    def prepare_allseries(self, ramflag=True):
        """Prepare the series objects of all `input`, `flux` and `state`
        sequences of the model handled by this element.

        Call this method before a simulation run, if you need access to
        (nearly) all simulated series of the handled model after the
        simulation run is finished.

        By default, the series are stored in RAM, which is the faster
        option.  If your RAM is limited, pass the `False` for function
        argument `ramflag` to store the series on disk.
        """
        self.prepare_inputseries(ramflag)
        self.prepare_fluxseries(ramflag)
        self.prepare_stateseries(ramflag)

    def prepare_inputseries(self, ramflag=True):
        """Prepare the series objects of the `input` sequences of the model
        handled by this element.

        See method |Element.prepare_allseries| for further information.
        """
        self._prepare_series('inputs', ramflag)

    def prepare_fluxseries(self, ramflag=True):
        """Prepare the series objects of the `flux` sequences of the model
        handled by this element.

        See method |Element.prepare_allseries| for further information.
        """
        self._prepare_series('fluxes', ramflag)

    def prepare_stateseries(self, ramflag=True):
        """Prepare the series objects of the `state` sequences of the model
        handled by this element.

        See method |Element.prepare_allseries| for further information.
        """
        self._prepare_series('states', ramflag)

    def _prepare_series(self, name_subseqs, ramflag):
        sequences = self.model.sequences
        subseqs = getattr(sequences, name_subseqs, None)
        if subseqs:
            if ramflag:
                subseqs.activate_ram()
            else:
                subseqs.activate_disk()

    def _plot(self, subseqs, names, kwargs):
        if names:
            selseqs = (getattr(subseqs, name) for name in names)
        else:
            selseqs = subseqs
        for seq in selseqs:
            if seq.NDIM == 0:
                label = kwargs.pop('label', ' '.join((self.name, seq.name)))
                pyplot.plot(seq.series, label=label, **kwargs)
                pyplot.legend()
            else:
                color = kwargs.pop('color', kwargs.pop('c', 'red'))
                pyplot.plot(seq.series, color=color, **kwargs)
        if not pyplot.isinteractive():
            pyplot.show()

    def plot_inputseries(self, names=None, **kwargs):
        """Plot the `input` series of the handled model.

        To plot the series of a subset of all sequences, pass the respective
        names.
        """
        self._plot(self.model.sequences.inputs, names, kwargs)

    def plot_fluxseries(self, names=None, **kwargs):
        """Plot the `flux` series of the handled model.

        To plot the series of a subset of all sequences, pass the respective
        names.
        """
        self._plot(self.model.sequences.fluxes, names, kwargs)

    def plot_stateseries(self, names=None, **kwargs):
        """Plot the `state` series of the handled model.

        To plot the series of a subset of all sequences, pass the respective
        names.
        """
        self._plot(self.model.sequences.states, names, kwargs)

    def assignrepr(self, prefix):
        """Defines the `visual appearence` of |Element| objects.

        You can pass a string which prefixes the string representation.
        """
        with objecttools.repr_.preserve_strings(True):
            with objecttools.assignrepr_tuple.always_bracketed(False):
                blanks = ' ' * (len(prefix) + 8)
                lines = ['%sElement("%s",' % (prefix, self.name)]
                for conname in ('inlets', 'outlets', 'receivers', 'senders'):
                    connections = getattr(self, conname, None)
                    if connections:
                        subprefix = '%s%s=' % (blanks, conname)
                        nodes = [str(node) for node in connections.slaves]
                        line = objecttools.assignrepr_list(
                            nodes, subprefix, width=70)
                        lines.append(line + ',')
                if self.keywords:
                    subprefix = '%skeywords=' % blanks
                    line = objecttools.assignrepr_list(
                        sorted(self.keywords), subprefix, width=70)
                    lines.append(line + ',')
                lines[-1] = lines[-1][:-1]+')'
                return '\n'.join(lines)

    def __repr__(self):
        return self.assignrepr('')


abctools.ElementABC.register(Element)


class Devices(object):
    """Base class for class |Elements| and class |Nodes|.

    There are only small differences between class |Elements| and class
    |Nodes|.  We focus our explanations on class |Nodes| arbitrarily.

    The following test objects are used to explain the methods
    and properties of class |Device| (note the different types of
    the initialization arguments):

    >>> from hydpy import dummies
    >>> from hydpy import Node, Nodes, Element, Elements
    >>> dummies.nodes = Nodes('na',
    ...                       Node('nb', variable='W'),
    ...                       Node('nc', keywords=('group_a', 'group_1')),
    ...                       Node('nd', keywords=('group_a', 'group_2')),
    ...                       Node('ne', keywords=('group_b', 'group_1')))
    >>> dummies.elements = Elements('ea', Element('eb'))

    In a nutshell, |Devices| instances are containers supporting
    attribute access.  You can access each device directly by its name:

    >>> nodes = dummies.nodes
    >>> nodes.na
    Node("na", variable="Q")

    Wrong device names result in the following error message:

    >>> nodes.na_
    Traceback (most recent call last):
    ...
    AttributeError: The selected Nodes object has neither a `na_` \
attribute nor does it handle a Node object with name or keyword `na_`, \
which could be returned.

    Sometimes it is more convenient to receive empty always iterables, even
    empty ones (especially when using keyword access, see below).  This
    cann be done by change the `return_always_iterables` class flag:

    >>> Nodes.return_always_iterables = True
    >>> nodes.na_
    Nodes()
    >>> nodes.na
    Nodes("na")
    >>> Nodes.return_always_iterables = False

    Attribute deleting is supported:

    >>> 'na' in nodes
    True
    >>> del nodes.na
    >>> 'na' in nodes
    False
    >>> del nodes.na
    Traceback (most recent call last):
    ...
    AttributeError: The selected Nodes object has neither a `na` attribute \
nor does it handle a Node object named `na`, which could be deleted.

    However, exemplified by the next example, setting devices as attributes
    "pythonically" could result in inconsistencies and is not allowed
    (see method |Devices.add_device| instead):

    >>> nodes.NF = Node('nf')
    Traceback (most recent call last):
    ...
    NotImplementedError: Setting attributes of Nodes objects could result \
in confusion whether a new attribute should be handled as a Node object or \
as a "normal" attribute and is thus not support.

    The operators `+`, `+=`, `-` and `-=` support adding and removing
    groups of devices:

    >>> subgroup = Nodes("nc", "ne")

    >>> nodes
    Nodes("nb", "nc", "nd", "ne")
    >>> subgroup
    Nodes("nc", "ne")
    >>> nodes - subgroup
    Nodes("nb", "nd")

    >>> nodes
    Nodes("nb", "nc", "nd", "ne")
    >>> nodes -= subgroup
    >>> nodes
    Nodes("nb", "nd")

    >>> nodes + subgroup
    Nodes("nb", "nc", "nd", "ne")
    >>> nodes
    Nodes("nb", "nd")
    >>> nodes += subgroup
    >>> nodes
    Nodes("nb", "nc", "nd", "ne")

    Trying to add already existing are to remove non existing devices
    does no harm:

    >>> nodes
    Nodes("nb", "nc", "nd", "ne")
    >>> nodes + subgroup
    Nodes("nb", "nc", "nd", "ne")
    >>> nodes - Node('na')
    Nodes("nb", "nc", "nd", "ne")

    Finally, the following "set operators" are supported:

    >>> subgroup < nodes, nodes < subgroup, nodes < nodes
    (True, False, False)
    >>> subgroup <= nodes, nodes <= subgroup, nodes <= nodes
    (True, False, True)
    >>> subgroup == nodes, nodes == subgroup, nodes == nodes
    (False, False, True)
    >>> subgroup != nodes, nodes != subgroup, nodes != nodes
    (True, True, False)
    >>> subgroup >= nodes, nodes >= subgroup, nodes >= nodes
    (False, True, True)
    >>> subgroup > nodes, nodes > subgroup, nodes > nodes
    (False, True, False)
    """

    _contentclass = None
    return_always_iterables = False

    def __init__(self, *values):
        with objecttools.ResetAttrFuncs(self):
            self._devices = {}
            self._shadowed_keywords = set()
        try:
            self._extract_values(values)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to initialize a `%s` object'
                % objecttools.classname(self))

    def _extract_values(self, values):
        for value in objecttools.extract(
                values, types=(self._contentclass, str), skip=True):
            self.add_device(value)

    def add_device(self, device):
        """Add the given |Node| or |Element| object.

        >>> from hydpy import Nodes
        >>> nodes = Nodes('old_node')
        >>> nodes.add_device('new_node')
        >>> nodes
        Nodes("new_node", "old_node")

        Note the implementation detail, that each new node knows the
        object it was added to:

        >>> nodes in nodes.new_node._handlers
        True
        """
        device = self._contentclass(device)
        self._devices[device.name] = device
        device.add_handler(self)

    def remove_device(self, device):
        """Remove the given |Node| or |Element| object.

        >>> from hydpy import Node, Nodes
        >>> nodes = Nodes('node_x', 'node_y')
        >>> node_x, node_y = nodes
        >>> nodes.remove_device('node_y')
        >>> nodes
        Nodes("node_x")

        Note the implementation detail, that a new node forgots its
        container object, after it has been removed:

        >>> nodes in node_x._handlers
        True
        >>> nodes in node_y._handlers
        False
        """
        device = self._contentclass(device)
        try:
            del self._devices[device.name]
        except KeyError:
            raise KeyError(
                'The selected %s object does not handle a %s object named '
                '`%s`, which could be removed.'
                % (objecttools.classname(self),
                   objecttools.classname(self._contentclass), device))
        device.remove_handler(self)

    @property
    def names(self):
        """A sorted tuple of the names of the handled devices.

        >>> from hydpy import dummies
        >>> dummies.nodes.names
        ('na', 'nb', 'nc', 'nd', 'ne')
        """
        return tuple(device.name for device in self)

    @property
    def devices(self):
        """A tuple of the handled devices sorted by the device names.

        >>> from hydpy import dummies
        >>> tuple(device.name for device in dummies.nodes.devices)
        ('na', 'nb', 'nc', 'nd', 'ne')
        """
        return tuple(device for device in self)

    @property
    def keywords(self):
        """A set of all keywords of all handled devices.

        In addition to attribute access via device names described above,
        |Device| objects allow for attribute access via keywords.
        This allows for an efficient search of certain groups of devices.
        Lets use the example from above, where the nodes `na` and `nb`
        have no keywords but each of the other three nodes both belongs
        to either `group_a` or `group_b` and `group_1` or `group_2`:

        >>> from hydpy import dummies
        >>> nodes = dummies.nodes
        >>> nodes
        Nodes("na", "nb", "nc", "nd", "ne")
        >>> sorted(nodes.keywords)
        ['group_1', 'group_2', 'group_a', 'group_b']

        If you are interesting in inspecting all nodes belonging to `group_a`,
        build a selection:

        >>> subgroup = nodes.group_1
        >>> subgroup
        Nodes("nc", "ne")

        You can further restrict the search by also selecting the nodes also
        belonging to `group_b`, which holds true for node `ne` only:

        >>> subsubgroup = subgroup.group_b
        >>> subsubgroup
        Node("ne", variable="Q",
             keywords=["group_1", "group_b"])

        Node that the keywords already used for building a subgroup of nodes
        are no informative anymore (as they hold true for each node) and are
        thus not shown anymore:

        >>> sorted(subgroup.keywords)
        ['group_a', 'group_b']

        The latter might be confusing, if you intend to work with a subgroup
        of nodes for a longer time.  After copying the subgroup, all keywords
        of the contained devices are available again:

        >>> newgroup = subgroup.copy()
        >>> sorted(newgroup.keywords)
        ['group_1', 'group_a', 'group_b']
        """
        return set(keyword for device in self
                   for keyword in device.keywords if
                   keyword not in self._shadowed_keywords)

    def open_files(self, idx=0):
        """Call method |Node.open_files| or |Element.open_files| of all
        contained |Node| or |Element| objects."""
        for device in self:
            device.open_files(idx)

    def close_files(self):
        """Call method |Node.close_files| or |Element.close_files| of
        all contained |Node| or |Element| objects."""
        for device in self:
            device.close_files()

    def copy(self):
        """Return a shallow copy of the actual |Devices| instance.

        Make a flat copy of the |Nodes| object defined above:

        >>> from hydpy import dummies
        >>> old = dummies.nodes
        >>> import copy
        >>> new = copy.copy(old)

        Show that the copy is not completely flat:

        >>> new == old
        True
        >>> new is old
        False
        >>> new._devices is old._devices
        False
        >>> new.na is new.na
        True

        The private variable `_devices` obviously has also been copied,
        but not the device `na`.  Allowing also to copy devices like `na`
        would be in conflict with using their names as identifiers.
        For this reason deep copying |Devices| objects is disabled:

        >>> copy.deepcopy(dummies.nodes)
        Traceback (most recent call last):
        ...
        NotImplementedError: Deep copying of Nodes objects is not supported, \
as it would require to make deep copies of the Node objects themselves, \
which is in conflict with using their names as identifiers.

        """
        new = type(self)()
        new.__dict__.update(self.__dict__)
        new.__dict__['_devices'] = copy.copy(self._devices)
        new.__dict__['_shadowed_keywords'].clear()
        for device in self:
            device.add_handler(new)
        return new

    __copy__ = copy

    def __deepcopy__(self, dict_):
        classname = objecttools.classname(self)
        raise NotImplementedError(
            'Deep copying of %s objects is not supported, as it would '
            'require to make deep copies of the %s objects themselves, '
            'which is in conflict with using their names as identifiers.'
            % (classname, classname[:-1]))

    def __iter__(self):
        for (name, device) in sorted(self._devices.items()):
            yield device

    def _select_devices_by_keyword(self, name):
        devices = self.__class__(device for device in self if
                                 name in device.keywords)
        devices.__dict__['_shadowed_keywords'] = self._shadowed_keywords.copy()
        devices._shadowed_keywords.add(name)
        return devices

    def __getattr__(self, name):
        try:
            _devices = object.__getattribute__(self, '_devices')
            _device = _devices[name]
            if self.return_always_iterables:
                return self.__class__(_device)
            return _device
        except KeyError:
            pass
        _devices = self._select_devices_by_keyword(name)
        if self.return_always_iterables or len(_devices) > 1:
            return _devices
        elif len(_devices) == 1:
            return _devices.devices[0]
        else:
            raise AttributeError(
                'The selected %s object has neither a `%s` attribute '
                'nor does it handle a %s object with name or keyword `%s`, '
                'which could be returned.'
                % (objecttools.classname(self), name,
                   objecttools.classname(self._contentclass), name))

    def __setattr__(self, name, value):
        classname = objecttools.classname(self)
        raise NotImplementedError(
            'Setting attributes of %s objects could result in confusion '
            'whether a new attribute should be handled as a %s object or '
            'as a "normal" attribute and is thus not support.'
            % (classname, classname[:-1]))

    def __delattr__(self, name):
        deleted_something = False
        if name in vars(self):
            Devices.__delattr__(self, name)
            deleted_something = True
        if name in self._devices:
            self.remove_device(name)
            deleted_something = True
        if not deleted_something:
            raise AttributeError(
                'The selected %s object has neither a `%s` attribute nor does '
                'it handle a %s object named `%s`, which could be deleted.'
                % (objecttools.classname(self), name,
                   objecttools.classname(self._contentclass), name))

    def __contains__(self, device):
        device = self._contentclass(device)
        return device.name in self._devices

    def __len__(self):
        return len(self._devices)

    def __add__(self, values):
        new = self.copy()
        for device in self.__class__(values):
            new.add_device(device)
        return new

    def __iadd__(self, values):
        for device in self.__class__(values):
            self.add_device(device)
        return self

    def __sub__(self, values):
        new = self.copy()
        for device in self.__class__(values):
            try:
                new.remove_device(device)
            except KeyError:
                pass
        return new

    def __isub__(self, values):
        for device in self.__class__(values):
            try:
                self.remove_device(device)
            except KeyError:
                pass
        return self

    def __lt__(self, other):
        return set(self._devices.keys()) < set(other._devices.keys())

    def __le__(self, other):
        return set(self._devices.keys()) <= set(other._devices.keys())

    def __eq__(self, other):
        return set(self._devices.keys()) == set(other._devices.keys())

    def __ne__(self, other):
        return set(self._devices.keys()) != set(other._devices.keys())

    def __ge__(self, other):
        return set(self._devices.keys()) >= set(other._devices.keys())

    def __gt__(self, other):
        return set(self._devices.keys()) > set(other._devices.keys())

    def __hash__(self):
        return id(self)

    def __repr__(self):
        return self.assignrepr('')

    def assignrepr(self, prefix):
        """Return a string representation of the actual |Devices| object
        prefixed with the given string."""
        with objecttools.repr_.preserve_strings(True):
            with pub.options.ellipsis(2, optional=True):
                prefix += '%s(' % objecttools.classname(self)
                repr_ = objecttools.assignrepr_values(
                    self.names, prefix, width=70)
                return repr_ + ')'

    def __dir__(self):
        """Just a regression test:

        >>> from hydpy import dummies
        >>> from hydpy.core.objecttools import assignrepr_values
        >>> print(assignrepr_values(dir(dummies.nodes), '', 70))
        add_device, assignrepr, close_files, copy, devices, group_1, group_2,
        group_a, group_b, keywords, na, names, nb, nc, nd, ne, open_files,
        prepare_allseries, prepare_obsseries, prepare_simseries,
        remove_device, return_always_iterables, save_allseries,
        save_obsseries, save_simseries
        """
        return objecttools.dir_(self) + list(self.names) + list(self.keywords)


class Nodes(Devices):
    """A container for handling |Node| objects."""

    _contentclass = Node

    @printtools.print_progress
    def prepare_allseries(self, ramflag=True):
        """Call methods |Node.prepare_simseries| and |
        Node.prepare_obsseries|."""
        self.prepare_simseries(ramflag)
        self.prepare_obsseries(ramflag)

    @printtools.print_progress
    def prepare_simseries(self, ramflag=True):
        """Call method |Node.prepare_simseries| of each handled
        |Node| object."""
        for node in printtools.progressbar(self):
            node.prepare_simseries(ramflag)

    @printtools.print_progress
    def prepare_obsseries(self, ramflag=True):
        """Call method |Node.prepare_obsseries| of each handled
        |Node| object."""
        for node in printtools.progressbar(self):
            node.prepare_obsseries(ramflag)

    @printtools.print_progress
    def save_allseries(self):
        """Call methods |Nodes.save_simseries| and |Nodes.save_obsseries|."""
        self.save_simseries()
        self.save_obsseries()

    @printtools.print_progress
    def save_simseries(self, ramflag=True):
        """Call method |IOSequence.save_ext| of all  "memory flag activated"
        |NodeSequence| objects storing simulated  values handled (indirectly)
        by each |Node| object."""
        self._save_nodeseries('sim', pub.sequencemanager.simoverwrite)

    @printtools.print_progress
    def save_obsseries(self, ramflag=True):
        """Call method |IOSequence.save_ext| of all "memory flag activated"
        |NodeSequence| objects storing observed values handled (indirectly)
        by each |Node| object."""
        self._save_nodeseries('obs', pub.sequencemanager.obsoverwrite)

    def _save_nodeseries(self, seqname, overwrite):
        for node in printtools.progressbar(self):
            seq = getattr(node.sequences, seqname)
            if seq.memoryflag:
                if overwrite or not os.path.exists(seq.filepath_ext):
                    seq.save_ext()
                else:
                    warnings.warn(
                        'Due to the argument `overwrite` being `False` '
                        'it is not allowed to overwrite the already '
                        'existing file `%s`.'
                        % seq.filepath_ext)


class Elements(Devices):
    """A container for handling |Element| objects."""

    _contentclass = Element

    @printtools.print_progress
    def init_models(self):
        """Call method |Element.init_model| of each handled |Element| object
        and afterwards method |Parameters.update| of the |Parameters| object
        handled (indirectly) by each |Element| object."""
        warn = pub.options.warnsimulationstep
        pub.options.warnsimulationstep = False
        try:
            for element in printtools.progressbar(self):
                try:
                    element.init_model(clear_registry=False)
                except IOError as exc:
                    temp = 'While trying to load the control file'
                    if ((temp in str(exc)) and
                            pub.options.warnmissingcontrolfile):
                        warnings.warn('No model could be initialized for '
                                      'element `%s`' % element)
                        self.__dict__['model'] = None
                    else:
                        objecttools.augment_excmessage(
                            'While trying to initialize the model of '
                            'element `%s`' % element)
                else:
                    element.model.parameters.update()
        finally:
            pub.options.warnsimulationstep = warn
            pub.controlmanager.clear_registry()

    def connect(self):
        """Call method |Element.connect| of each |Element| object and
        function |Parameters.update| of the |Parameters| object handled
        (indirectly) by each |Element| object."""
        for element in self:
            element.connect()
            element.model.parameters.update()

    @printtools.print_progress
    def save_controls(self, controldir=None, projectdir=None,
                      parameterstep=None, simulationstep=None,
                      auxfiler=None):
        """Save the control parameters of the |Model| object handled by
        each |Element| object and eventually the ones handled by the
        given |Auxfiler| object."""
        _currentdir = pub.controlmanager._currentdir
        _projectdir = pub.controlmanager.projectdir
        try:
            if controldir:
                pub.controlmanager.currentdir = controldir
            if projectdir:
                pub.controlmanager.projectdir = projectdir
            if auxfiler:
                auxfiler.save()
            for element in printtools.progressbar(self):
                element.model.parameters.save_controls(
                    parameterstep=parameterstep,
                    simulationstep=simulationstep,
                    auxfiler=auxfiler)
        finally:
            pub.controlmanager._currentdir = _currentdir
            pub.controlmanager.projectdir = _projectdir

    @printtools.print_progress
    def load_conditions(self, conditiondir=None, projectdir=None):
        """Save the initial conditions of the |Model| object handled by
        each |Element| object."""
        _currentdir = pub.conditionmanager._currentdir
        _projectdir = pub.conditionmanager.projectdir
        try:
            if projectdir:
                pub.conditionmanager.projectdir = projectdir
            if conditiondir:
                pub.conditionmanager.currentdir = conditiondir
            for element in printtools.progressbar(self):
                element.model.sequences.load_conditions()
        finally:
            pub.conditionmanager._currentdir = _currentdir
            pub.conditionmanager.projectdir = _projectdir

    @printtools.print_progress
    def save_conditions(self, conditiondir=None, projectdir=None,
                        controldir=None):
        """Save the calculated conditions of the |Model| object handled by
        each |Element| object."""
        _conditiondir = pub.conditionmanager._currentdir
        _projectdir = pub.conditionmanager.projectdir
        _controldir = pub.controlmanager._currentdir
        try:
            if projectdir:
                pub.conditionmanager.projectdir = projectdir
            if conditiondir:
                pub.conditionmanager.currentdir = conditiondir
            if controldir:
                pub.controlmanager.currentdir = controldir
            for element in printtools.progressbar(self):
                element.model.sequences.save_conditions()
        finally:
            pub.conditionmanager._currentdir = _conditiondir
            pub.conditionmanager.projectdir = _projectdir
            pub.controlmanager._currentdir = _controldir

    def trim_conditions(self):
        """Call method |Sequences.trim_conditions| of the |Sequences|
        object handled (indirectly) by each |Element| object."""
        for element in self:
            element.model.sequences.trim_conditions()

    def reset_conditions(self):
        """Call method |Sequences.reset| of the |Sequences| object
        handled (indirectly) by each |Element| object."""
        for element in self:
            element.model.sequences.reset()

    @printtools.print_progress
    def prepare_allseries(self, ramflag=True):
        """Call method |Element.prepare_allseries| of each handled
        |Element| object."""
        for element in printtools.progressbar(self):
            element.prepare_allseries(ramflag)

    @printtools.print_progress
    def prepare_inputseries(self, ramflag=True):
        """Call method |Element.prepare_inputseries| of each handled
        |Element| object."""
        for element in printtools.progressbar(self):
            element.prepare_inputseries(ramflag)

    @printtools.print_progress
    def prepare_fluxseries(self, ramflag=True):
        """Call method |Element.prepare_fluxseries| of each handled
        |Element| object."""
        for element in printtools.progressbar(self):
            element.prepare_fluxseries(ramflag)

    @printtools.print_progress
    def prepare_stateseries(self, ramflag=True):
        """Call method |Element.prepare_stateseries| of each handled
        |Element| object."""
        for element in printtools.progressbar(self):
            element.prepare_stateseries(ramflag)

    @printtools.print_progress
    def save_allseries(self):
        """Call methods |Elements.save_inputseries|,
        |Elements.save_fluxseries|, and |Elements.save_stateseries|."""
        self.save_inputseries()
        self.save_fluxseries()
        self.save_stateseries()

    @printtools.print_progress
    def save_inputseries(self):
        """Call method |IOSequence.save_ext| of all "memory flag activated"
        |InputSequence| objects handled (indirectly) by each |Element|
        object."""
        self._save_modelseries('inputs', pub.sequencemanager.inputoverwrite)

    @printtools.print_progress
    def save_fluxseries(self):
        """Call method |IOSequence.save_ext| of all "memory flag activated"
        |FluxSequence| objects handled (indirectly) by each |Element|
        object."""
        self._save_modelseries('fluxes', pub.sequencemanager.outputoverwrite)

    @printtools.print_progress
    def save_stateseries(self):
        """Call method |IOSequence.save_ext| of all "memory flag activated"
        |StateSequence| objects handled (indirectly) by each |Element|
        object."""
        self._save_modelseries('states', pub.sequencemanager.outputoverwrite)

    def _save_modelseries(self, name_subseqs, overwrite):
        for element in printtools.progressbar(self):
            sequences = element.model.sequences
            subseqs = getattr(sequences, name_subseqs, ())
            for seq in subseqs:
                if seq.memoryflag:
                    if overwrite or not os.path.exists(seq.filepath_ext):
                        seq.save_ext()
                    else:
                        warnings.warn(
                            'Due to the argument `overwrite` being `False` '
                            'it is not allowed to overwrite the already '
                            'existing file `%s`.'
                            % seq.filepath_ext)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/dummytools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
# -*- coding: utf-8 -*-
"""This module is thought for easing doctests only."""

# import...
# ...from standard library
from __future__ import division, print_function
import copy
# ...from HydPy
from hydpy.core import autodoctools


class Dummies(object):
    """Handles "global" doctest data.

    A typical use pattern is to generated the instance of a class in the
    main docstring of the class and to test the different class methods
    based on this instance in separate docstrings afterwards.

    Class |Dummies| tries to ensure that the original objects are
    not altered due to performing different tests.  This protection
    mechanism is successfull for the simple following test class:

    >>> class Test(object):
    ...
    ...     def __init__(self):
    ...         self.name = 'some_name'
    ...         self.values = [1, 2, 3]

    As shown by the following results, neither the name nor the values of
    `dummies.test` can be altered by changing the respective
    attributes of the local object `test`:

    >>> from hydpy import dummies
    >>> dummies.test = Test()
    >>> test = dummies.test
    >>> test.name = 'different_name'
    >>> dummies.test.name
    'some_name'
    >>> test.values[1] = 4
    >>> dummies.test.values
    [1, 2, 3]

    The show pretection mechanism is implemented via making "deep copies"
    of objects handled by |Dummies| objects.  So lets see what happens
    when we subclass the test class and disable deep copying:

    >>> class Test(Test):
    ...
    ...     def __deepcopy__(self, dict_):
    ...         raise NotImplementedError()

    Repeating the the above examples still shows that attribute `name` is
    still protected but attribute `values` is not, meaning `test` is only
    a flat copy of `dummies.test`:

    >>> from hydpy import dummies
    >>> dummies.test = Test()
    >>> test = dummies.test
    >>> test.name = 'different_name'
    >>> dummies.test.name
    'some_name'
    >>> test.values[1] = 4
    >>> dummies.test.values
    [1, 4, 3]

    When we also disable flat copying, neither the name nor the values
    of `dummies.test` are protected:

    >>> class Test(Test):
    ...
    ...     def __copy__(self):
    ...         raise NotImplementedError()

    >>> from hydpy import dummies
    >>> dummies.test = Test()
    >>> test = dummies.test
    >>> test.name = 'different_name'
    >>> dummies.test.name
    'different_name'
    >>> test.values[1] = 4
    >>> dummies.test.values
    [1, 4, 3]

    After each test of a complete module, the dummy object is empty again
    (except for variable names starting with two underscores).
    """

    def clear(self):
        for name in list(vars(self)):
            delattr(self, name)

    def __setattr__(self, name, value):
        object.__setattr__(self, '_'+name, value)

    def __getattr__(self, name):
        try:
            obj = object.__getattribute__(self, '_'+name)
        except AttributeError:
            raise AttributeError('Dummies object does not handle an object '
                                 'named `%s` at the moment.' % name)
        try:
            return copy.deepcopy(obj)
        except BaseException:
            pass
        try:
            return copy.copy(obj)
        except BaseException:
            pass
        return obj


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/exceptiontools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
# -*- coding: utf-8 -*-
"""This module implements some exception classes and related features."""

# import...
# ...from site-packages
import wrapt
# ...from HydPy
from hydpy import pub
from hydpy.core import autodoctools
from hydpy.core import objecttools


class AttributeNotReady(AttributeError):
    """The attribute is principally defined, but must be prepared first."""


class IsReady(object):
    """Container that informs, whether all variables required in a certain
    context are properly prepared or not.

    All variables can start with a `True` or `False` value:

    >>> from hydpy.core.exceptiontools import IsReady
    >>> isready = IsReady(true=['x', 'y'], false=['z'])
    >>> isready.x
    True
    >>> isready.z
    False

    If there is at least one `False` value, the |IsReady| object itself
    is considered to be `False`:

    >>> isready
    IsReady(true=['x', 'y'],
            false=['z'])
    >>> bool(isready)
    False

    Only in case all values are `True`, `isready` is considered to the
    `True`:

    >>> isready.z = True
    >>> isready
    IsReady(true=['x', 'y', 'z'],
            false=[])
    >>> bool(isready)
    True
    """

    def __init__(self, true=(), false=()):
        for name in true:
            setattr(self, name, True)
        for name in false:
            setattr(self, name, False)

    @property
    def true(self):
        """Sorted tuple of the names of all `True` variables.

        >>> from hydpy.core.exceptiontools import IsReady
        >>> isready = IsReady(true=['b', 'c', 'a'], false=['z'])
        >>> isready.true
        ('a', 'b', 'c')
        """
        return tuple(name for (name, value) in self if value)

    @property
    def false(self):
        """Sorted tuple of the names of all `False` variables.

        >>> from hydpy.core.exceptiontools import IsReady
        >>> isready = IsReady(false=['b', 'c', 'a'], true=['z'])
        >>> isready.false
        ('a', 'b', 'c')
        """
        return tuple(name for (name, value) in self if not value)

    def __bool__(self):
        return all(vars(self).values())

    def __nonzero__(self):   # pragma: no cover
        return self.__bool__()

    def __iter__(self):
        for key, value in sorted(vars(self).items()):
            yield key, value

    def __repr__(self):
        true = ["'%s'" % name for name in self.true]
        false = ["'%s'" % name for name in self.false]
        arl = objecttools.assignrepr_list
        return (arl(true, 'IsReady(true=', width=70) + ',\n' +
                arl(false, '        false=', width=70) + ')')


def _objectname(self):
    return getattr(self, 'name', objecttools.instancename(self))


def protected_property(propname, fget, fset=None, fdel=None):
    """Return a |property| which prevents getting an attribute
    before setting it.

    Under some circumstances, an attribute value needs to be prepared
    before one should be allowed to query it.  Consider the case where
    a property of a Python class (beeing part of the API) links to an
    attribute of a Cython extension class (not part of the API).  If
    the Cython attribute is e.g. some type of vector requiring memory
    allocation, trying to query this vector befor it has actually been
    prepared results in a programm crash.  Using |protected_property|
    is a means to prevent from such problems to occur.

    Consider the following class `Test`, which defines most simple
    `set`, `get`, and `del` methods for its only property `x`:

    >>> from hydpy.core.exceptiontools import IsReady, protected_property
    >>> class Test(object):
    ...
    ...     def __init__(self):
    ...         self._x = None
    ...         self._isready = IsReady(false=['x'])
    ...
    ...     def _get_x(self):
    ...         return self._x
    ...
    ...     def _set_x(self, value):
    ...         self._x = value
    ...
    ...     def _del_x(self):
    ...         self._x = None
    ...
    ...     x = protected_property(
    ...         'x', _get_x, _set_x, _del_x)

    Due to using |protected_property| instead of |property|, trying
    to query `x` after initializing a `Test` object results in an
    |AttributeNotReady| error:

    >>> test = Test()
    >>> test.x
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `test` has not been \
prepared so far.

    After setting a value for property `x`, this value can be queried
    as expected:

    >>> test.x = 1
    >>> test.x
    1

    After deleting `x`, its valu is not accessible, again:

    >>> del test.x
    >>> test.x
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `test` has not been \
prepared so far.

    If the considered object defines a name (different from the class
    name in lower letters) and/or references a |Node| or |Element|
    object, the exception message includes this additional information:

    >>> from hydpy import Element
    >>> test.name = 'name_object'
    >>> test.element = Element('name_element')

    >>> test.x
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `name_object` of \
element `name_element` has not been prepared so far.

    As for |property|, the `set` and `del` can be omitted.  As an
    example, we redefine class `Test` with a `get` method only:

    >>> class Test(object):
    ...
    ...     def __init__(self):
    ...         self._x = None
    ...         self._isready = IsReady(false=['x'])
    ...
    ...     def _get_x(self):
    ...         return self._x
    ...
    ...     x = protected_property(
    ...         'x', _get_x)
    >>> test = Test()

    Now trying to set a new value results in the usual error...

    >>> test.x = 1
    Traceback (most recent call last):
    ...
    AttributeError: cannot set attribute

    ...and does not change the value of attribute `x`:

    >>> test.x
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `test` has not been \
prepared so far.

    The same holds true for trying to delete the value of attribute `x`:

    >>> del test.x
    Traceback (most recent call last):
    ...
    AttributeError: cannot delete attribute

    .. note::

        The class making use of |protected_property| must implement
        an |IsReady| member as shown in the example.  The member name
        `_isready` is mandatory.
    """
    # pylint: disable=no-value-for-parameter, unused-argument, protected-access
    @wrapt.decorator
    def wrap_fget(wrapped, instance, args, kwargs):
        """Wrap the get function."""
        self = args[0]
        if getattr(self._isready, propname):
            return wrapped(*args, **kwargs)
        else:
            raise AttributeNotReady(
                'Attribute `%s` of object `%s`%shas not been prepared so far.'
                % (propname,
                   _objectname(self),
                   objecttools.devicephrase(self)))

    @wrapt.decorator
    def wrap_fset(wrapped, instance, args, kwargs):
        """Wrap the set function."""
        if wrapped:
            wrapped(*args, **kwargs)
            setattr(args[0]._isready, propname, True)
        else:
            raise AttributeError(
                'cannot set attribute')

    @wrapt.decorator
    def wrap_fdel(wrapped, instance, args, kwargs):
        """Wrap the del function."""
        if wrapped:
            wrapped(*args, **kwargs)
            setattr(args[0]._isready, propname, False)
        else:
            raise AttributeError(
                'cannot delete attribute')

    return property(wrap_fget(fget), wrap_fset(fset), wrap_fdel(fdel))


def dependent_property(propname, fget, fset=None, fdel=None):
    """Return a |property| which prevents accessing a dependent attribute
    before other attributes have been prepared.

    The following explanations suppose first reading the documentation
    on function |protected_property|.  Here the example class `Test` is
    defined very similarly, but `x` is returned by |dependent_property|
    instead of |protected_property|, and the |IsReady| member knows
    another attribute `y` but not the dependent attribute `x` (usually
    but not mandatory, `y` itself would be implemented as a
    |protected_property|, which is left out for reasons of brevity):

    >>> from hydpy.core.exceptiontools import IsReady, protected_property
    >>> from hydpy.core.exceptiontools import dependent_property
    >>> class Test(object):
    ...
    ...     def __init__(self):
    ...         self._x = None
    ...         self._isready = IsReady(false=['y'])
    ...
    ...     def _get_x(self):
    ...         return self._x
    ...
    ...     def _set_x(self, value):
    ...         self._x = value
    ...
    ...     def _del_x(self):
    ...         self._x = None
    ...
    ...     x = dependent_property(
    ...         'x', _get_x, _set_x, _del_x)

    Initially, due to `y` beeing not prepared according to `_isready`,
    there is no way to get, set, or delete attribute `x`:

    >>> test = Test()
    >>> test.x
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `test` is not usable so far.

    >>> test.x = 1
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `test` is not usable so far.

    >>> del test.x
    Traceback (most recent call last):
    ...
    AttributeNotReady: Attribute `x` of object `test` is not usable so far.

    However, after setting the `y` flag to `True`, `x` behaves like a
    "normal" property:

    >>> test._isready.y = True
    >>> test.x = 1
    >>> test.x
    1
    >>> del test.x
    >>> test.x
    """
    # pylint: disable=no-value-for-parameter, unused-argument
    @wrapt.decorator
    def wrapper(wrapped, instance, args, kwargs):
        """Wrap the get, set, or del method."""
        self = args[0]
        if not wrapped:
            raise AttributeError(
                'Attribute `%s` of object `%s`%scannot be used this way.'
                % (propname,
                   _objectname(self),
                   objecttools.devicephrase(self)))
        elif self._isready:
            return wrapped(*args, **kwargs)
        else:
            raise AttributeNotReady(
                'Attribute `%s` of object `%s`%sis not usable so far.'
                % (propname,
                   _objectname(self),
                   objecttools.devicephrase(self)))

    return property(wrapper(fget), wrapper(fset), wrapper(fdel))


class OptionalModuleNotAvailable(ImportError):
    """A `HydPy` function requiring an optional module is called, but this
    module is not available."""


class OptionalImport(object):
    """Exectutes the given import command and returns the imported module.
    If importomg is not possible, it returns a dummy object which raises
    a |OptionalModuleNotAvailable| each time a one tries to access a
    member of the orignal module.

    If the module is availabe:

    >>> from hydpy.core.exceptiontools import OptionalImport
    >>> numpy = OptionalImport('import numpy')
    >>> numpy.nan
    nan

    If the module is not available:

    >>> numpie = OptionalImport('import numpie')
    >>> numpie.nan
    Traceback (most recent call last):
    ...
    OptionalModuleNotAvailable: HydPy could not load module `numpie`.  \
This module is no general requirement but necessary for some \
specific functionalities.

    If the module is available, but HydPy had been bundled to an
    executable:

    >>> from hydpy import pub
    >>> pub._is_hydpy_bundled = True
    >>> os = OptionalImport('import os')
    >>> os.getcwd()
    Traceback (most recent call last):
    ...
    OptionalModuleNotAvailable: HydPy could not load module `os`.  \
This module is no general requirement but necessary for some \
specific functionalities.

    The latter can be prevented by passing a `True` `bundle_module`
    argument:

    >>> textwrap = OptionalImport('import textwrap', bundle_module=True)
    >>> textwrap.wrap('')
    []

    >>> pub._is_hydpy_bundled = False
    """

    def __new__(cls, command, bundle_module=False):
        try:
            if pub._is_hydpy_bundled and not bundle_module:
                raise ImportError()
            exec(command)
            return eval(command.split()[-1])
        except BaseException:
            return object.__new__(cls)

    def __init__(self, command):
        self.name = command.split()[-1]

    def __getattr__(self, name):
        raise OptionalModuleNotAvailable(
            'HydPy could not load module `%s`.  This module is no '
            'general requirement but necessary for some specific '
            'functionalities.'
            % self.name)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/filetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
# -*- coding: utf-8 -*-
"""This module implements tools for handling the folder structure
of HydPy projects.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import os
import runpy
# ...from HydPy
from hydpy import pub
from hydpy.core import autodoctools
from hydpy.core import devicetools
from hydpy.core import objecttools
from hydpy.core import selectiontools


class _Directories(object):

    def __init__(self, *args, **kwargs):
        for arg in args:
            self.add(arg)
        for (key, value) in kwargs.items():
            self.add(key, value)

    def add(self, directory, path=None):
        """Add a directory and optionally its path."""
        if path is None:
            path = directory
        try:
            exec('self.%s = r"%s"' % (directory, path))
        except BaseException:
            raise IOError(
                'The directory name `%s` cannot be handled as a '
                'variable name.  Please avoid arithmetic operators '
                'like `-`, prefixed numbers...'
                % directory)

    def __iter__(self):
        for (key, value) in vars(self).items():
            yield (key, value)

    def __getitem__(self, key):
        return sorted(vars(self).values())[key]

    def __len__(self):
        return len(vars(self))

    def __repr__(self):
        if self:
            args, kwargs = [], []
            for key, value in self:
                if key == value:
                    args.append(key)
                else:
                    kwargs.append('%s=%s' % (key, value))
            lines = ['             %s,' % arg for arg in args+kwargs]
            lines[0] = '_Directories(' + lines[0][11:]
            lines[-1] = lines[-1][:-1] + ')'
            return '\n'.join(lines)
        return '_Directories()'

    def __dir__(self):
        return objecttools.dir_(self)


class FileManager(object):
    """Base class for the more specific file managers implemented in
    module |filetools|."""

    def __init__(self):
        self._BASEDIR = 'must_be_overwritten'
        self.projectdir = pub.projectname
        self._currentdir = None
        self._defaultdir = None
        self.createdirs = False
        self.deletedirs = False

    @property
    def basepath(self):
        """Absolute path pointing to the actual directories."""
        return os.path.abspath(
            os.path.join(self.projectdir, self._BASEDIR))

    @property
    def availabledirs(self):
        """Available directories containing the respective files."""
        directories = _Directories()
        for directory in os.listdir(self.basepath):
            if not directory.startswith('_'):
                path = os.path.join(self.basepath, directory)
                if os.path.isdir(path):
                    directories.add(directory)
        return directories

    def _get_currentdir(self):
        """Current directory containing the network files."""
        directories = self.availabledirs
        if self._currentdir:
            directory = self._make_and_get_currentdir(
                directories, self._currentdir)
            if directory:
                return directory
            else:
                raise IOError(
                    'The base path `%s` does not contain the currently '
                    'set directory `%s` and creating a new directory is '
                    'currently disabled.'
                    % (self.basepath, self._currentdir))
        if self._defaultdir:
            directory = self._make_and_get_currentdir(
                directories, self._defaultdir)
        else:
            directory = None
        if directory:
            return directory
        else:
            raise IOError(
                'The base path `%s` does not contain the default directory '
                '`%s`.  Please specify he current directory to be worked '
                'with manually.'
                % (self.basepath, self._defaultdir))

    def _make_and_get_currentdir(self, directories, directory):
        try:
            return getattr(directories, directory)
        except AttributeError:
            if self.createdirs:
                path = os.path.join(self.basepath, directory)
                os.makedirs(path)
                return directory
            return None

    def _set_currentdir(self, directory):
        path = os.path.join(self.basepath, directory)
        if not os.path.exists(path):
            if self.createdirs:
                os.makedirs(path)
            else:
                raise IOError(
                    'The base path `%s` does not contain directory `%s` '
                    'and creating a new directory is currently disabled.'
                    % (self.basepath, directory))
        self._currentdir = str(directory)

    def _del_currentdir(self):
        if self.deletedirs:
            path = os.path.join(self.basepath, self.currentdir)
            if os.path.exists(path):
                os.removedirs(path)
        self._currentdir = None

    currentdir = property(_get_currentdir, _set_currentdir, _del_currentdir)

    @property
    def currentpath(self):
        """Complete path of the directory containing the respective files."""
        return os.path.join(self.basepath, self.currentdir)

    @property
    def filenames(self):
        """Tuple of names of the respective files of the current directory."""
        return tuple(fn for fn in os.listdir(self.currentpath)
                     if (fn.endswith('.py') and not fn.startswith('_')))

    @property
    def filepaths(self):
        """Tuple of paths of the respective files of the current directory."""
        path = self.currentpath
        return tuple(os.path.join(path, name) for name in self.filenames)


class NetworkManager(FileManager):
    """Manager for network files."""

    def __init__(self):
        FileManager.__init__(self)
        self._BASEDIR = 'network'
        self._defaultdir = 'default'

    def load_files(self):
        """Load nodes and elements from all network files and return them in
        a |Selections| instance.  Each single network file defines a separate
        |Selection| instance.  Additionally, all |Element| and |Node| objects
        are bundled in a selection named `complete`.
        """
        selections = selectiontools.Selections()
        for (filename, path) in zip(self.filenames, self.filepaths):
            # Ensure both `Node` and `Element`start with a `fresh` memory.
            devicetools.Node.gather_new_nodes()
            devicetools.Element.gather_new_elements()
            try:
                info = runpy.run_path(path)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to load the network file `%s`'
                    % path)
            try:
                selections += selectiontools.Selection(
                    filename.split('.')[0],
                    info['Node'].gather_new_nodes(),
                    info['Element'].gather_new_elements())
            except KeyError as exc:
                raise KeyError(
                    'The class `%s` cannot be loaded from the network '
                    'file `%s`.  Please refer to the HydPy documentation '
                    'on how to prepare network files properly.'
                    % (exc.args[0], filename))
        selections += selectiontools.Selection(
            'complete',
            info['Node'].registered_nodes(),
            info['Element'].registered_elements())
        return selections

    def save_files(self, selections):
        """Save the nodes and elements from each |Selection| object contained
        within the given |Selections| instance to a separate network file of
        the same name.
        """
        try:
            currentpath = self.currentpath
            selections = selectiontools.Selections(selections)
            for selection in selections:
                if selection.name == 'complete':
                    continue
                path = os.path.join(currentpath, selection.name+'.py')
                selection.save(path=path, write_nodes=True)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to save selections `%s` into network files'
                % selections)

    def delete_files(self, selections):
        """Delete network files.  One or more filenames and/or |Selection|
        instances can serve as function arguments.
        """
        try:
            currentpath = self.currentpath
            for selection in selections:
                name = str(selection)
                if name == 'complete':
                    continue
                if not name.endswith('.py'):
                    name += '.py'
                path = os.path.join(currentpath, name)
                os.remove(path)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to remove the network files of selections `%s`'
                % selections)

    def __dir__(self):
        return objecttools.dir_(self)


class ControlManager(FileManager):
    """Manager for control parameter files."""

    # The following file path to content mapping is used to circumvent reading
    # the same auxiliary control parameter file from disk multiple times.
    _registry = {}
    _workingpath = '.'

    def __init__(self):
        FileManager.__init__(self)
        self._BASEDIR = 'control'
        self._defaultdir = 'default'

    def load_file(self, element=None, filename=None, clear_registry=True):
        """Return the namespace of the given file (and eventually of its
        corresponding auxiliary subfiles) as a |dict|.

        By default, the internal registry is cleared when a control file and
        all its corresponding auxiliary files have been loaded.  You can
        change this behaviour by passing `False` for the `clear_registry`
        argument.  This might decrease model initialization times
        significantly.  But then it is your own responsibility to call
        method |ControlManager.clear_registry| when necessary (before
        reloading a changed control file).
        """
        if not filename:
            filename = element.name
        type(self)._workingpath = self.currentpath
        info = {}
        if element:
            info['element'] = element
        try:
            self.read2dict(filename, info)
        finally:
            type(self)._workingpath = '.'
            if clear_registry:
                self._registry.clear()
        return info

    @classmethod
    def read2dict(cls, filename, info):
        """Read the control parameters from the given path (and its
        auxiliary paths, where appropriate) and store them in the given
        |dict| object `info`.

        Note that the |dict| `info` can be used to feed information
        into the execution of control files.  Use this method only if you
        are completely sure on how the control parameter import of HydPy
        works.  Otherwise, you should most probably prefer to use
        |ControlManager.load_file|.
        """
        if not filename.endswith('.py'):
            filename += '.py'
        path = os.path.join(cls._workingpath, filename)
        try:
            if path not in cls._registry:
                with open(path) as file_:
                    cls._registry[path] = file_.read()
            exec(cls._registry[path], {}, info)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to load the control file `%s`'
                % path)
        if 'model' not in info:
            raise IOError(
                'Model parameters cannot be loaded from control file `%s`.  '
                'Please refer to the HydPy documentation on how to prepare '
                'control files properly.'
                % path)

    @classmethod
    def clear_registry(cls):
        """Clear the internal registry of read control files.
        """
        cls._registry.clear()

    def save_file(self, filename, text):
        """Save the given text under the given control filename and the
        current path."""
        if not filename.endswith('.py'):
            filename += '.py'
        path = os.path.join(self.currentpath, filename)
        with open(path, 'w', encoding="utf-8") as file_:
            file_.write(text)


class ConditionManager(FileManager):
    """Manager for condition files."""

    def __init__(self):
        FileManager.__init__(self)
        self._BASEDIR = 'conditions'
        self._defaultdir = None

    def load_file(self, filename):
        """Read and return the content of the given file.

        If the current directory is not defined explicitly, the directory
        name is constructed with the actual simulation start date.  If
        such an directory does not exist, it is created immediately.
        """
        _defaultdir = self._defaultdir
        try:
            if not filename.endswith('.py'):
                filename += '.py'
            try:
                self._defaultdir = (
                    'init_' + pub.timegrids.sim.firstdate.string('os'))
            except AttributeError:
                pass
            filepath = os.path.join(self.currentpath, filename)
            with open(filepath) as file_:
                return file_.read()
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to read the conditions file `%s`'
                % filename)
        finally:
            self._defaultdir = _defaultdir

    def save_file(self, filename, text):
        """Save the given text under the given condition filename and the
        current path.

        If the current directory is not defined explicitly, the directory
        name is constructed with the actual simulation end date.  If
        such an directory does not exist, it is created immediately.
        """
        _defaultdir = self._defaultdir
        try:
            if not filename.endswith('.py'):
                filename += '.py'
            try:
                self._defaultdir = (
                    'init_' + pub.timegrids.sim.lastdate.string('os'))
            except AttributeError:
                pass
            path = os.path.join(self.currentpath, filename)
            with open(path, 'w', encoding="utf-8") as file_:
                file_.write(text)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to write the conditions file `%s`'
                % filename)
        finally:
            self._defaultdir = _defaultdir


class _ContextDir(object):

    def __init__(self, value, sequence_type):
        self.value = value
        self.sequence_type = sequence_type
        self.__doc__ = (
            'Current directory containing the %s sequence files.'
            % sequence_type)

    def __get__(self, obj, type_=None):
        if obj is None:
            return self
        try:
            obj.currentdir = self.value
            return obj._currentdir
        except IOError:
            objecttools.augment_excmessage(
                'While trying to get the %s sequence directory'
                % self.sequence_type)
        finally:
            obj._currentdir = None

    def __set__(self, obj, directory):
        obj._inputdir = None
        try:
            obj.currentdir = directory
            self.value = directory
        except IOError:
            objecttools.augment_excmessage(
                'While trying to set the %s sequence directory'
                % self.sequence_type)
        finally:
            obj._currentdir = None

    def __delete__(self, obj):
        try:
            obj.currentdir = self.value
            del obj.currentdir
        except IOError:
            objecttools.augment_excmessage(
                'While trying to delete the input sequence directory')
        finally:
            self.value = None


class _ContextType(object):

    def __init__(self, value, sequence_type):
        self.value = value
        self.__doc__ = (
            'Currently selected type of the %s sequence files.'
            % sequence_type)

    def __get__(self, obj, type_=None):
        if obj is None:
            return self
        return self.value

    def __set__(self, obj, value):
        value = str(value)
        if value in obj._supportedmodes:
            self.value = value
        else:
            raise ValueError(
                'The given sequence file type `%s` is not implemented.  '
                'Please choose one of the following file types: %s.'
                % (value, objecttools.enumeration(obj._supportedmodes)))


class _ContextOverwrite(object):

    def __init__(self, value, sequence_type):
        self.value = value
        self.__doc__ = (
            'Currently selected overwrite flag of the %s sequence files.'
            % sequence_type)

    def __get__(self, obj, type_=None):
        if obj is None:
            return self
        return self.value

    def __set__(self, obj, value):
        self.value = bool(value)


class SequenceManager(FileManager):
    """Manager for sequence files."""

    _supportedmodes = ('npy', 'asc')

    inputdir = _ContextDir('input', 'input')
    outputdir = _ContextDir('output', 'output')
    nodedir = _ContextDir('node', 'node')
    tempdir = _ContextDir('temp', 'temporary')

    inputfiletype = _ContextType('npy', 'input')
    outputfiletype = _ContextType('npy', 'output')
    nodefiletype = _ContextType('npy', 'node')
    tempfiletype = _ContextType('npy', 'temporary')

    inputoverwrite = _ContextOverwrite(False, 'input')
    outputoverwrite = _ContextOverwrite(False, 'output')
    simoverwrite = _ContextOverwrite(False, 'sim node')
    obsoverwrite = _ContextOverwrite(False, 'obs node')
    tempoverwrite = _ContextOverwrite(False, 'temporary')

    def __init__(self):
        FileManager.__init__(self)
        self._BASEDIR = 'sequences'
        self._defaultdir = None

    @property
    def inputpath(self):
        """Absolute paths of the input sequence directory."""
        return os.path.join(self.basepath, self.inputdir)

    @property
    def outputpath(self):
        """Absolute paths of the selected output sequence directory."""
        return os.path.join(self.basepath, self.outputdir)

    @property
    def nodepath(self):
        """Absolute paths of the selected node sequence directory."""
        return os.path.join(self.basepath, self.nodedir)

    @property
    def temppath(self):
        """Absolute paths of the selected temporary sequence directory."""
        return os.path.join(self.basepath, self.tempdir)

    def __dir__(self):
        return objecttools.dir_(self)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/hydpytools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
# -*- coding: utf-8 -*-
"""This module implements superordinate tools for handling a HydPy project.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import warnings
# ...from HydPy
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import devicetools
from hydpy.core import filetools
from hydpy.core import printtools
from hydpy.core import selectiontools


class HydPy(object):
    """Main class for managing HydPy projects."""

    # A counter for the number of HydPy instances.
    nmb_instances = 0

    def __init__(self, projectname=None):

        # Increment and check number of HydPy instances.
        HydPy.nmb_instances += 1
        if HydPy.nmb_instances > 1:
            warnings.warn('Currently %d instances of HydPy are initialized '
                          'within the same process.  It is strongly '
                          'recommended to initialize only one instance at a '
                          'time.  Consider deleting all instances and '
                          'initializing a new one, unless you are fully aware '
                          'in what manner HydPy is relying on some global '
                          'information stored in module `pub`.'
                          % HydPy.nmb_instances)
        self.nodes = None
        self.elements = None
        self.deviceorder = None
        # Store public information in a separate module.
        if projectname is not None:
            pub.projectname = projectname
            pub.networkmanager = filetools.NetworkManager()
            pub.controlmanager = filetools.ControlManager()
            pub.sequencemanager = filetools.SequenceManager()
            pub.conditionmanager = filetools.ConditionManager()

    @printtools.print_progress
    def prepare_network(self):
        """Load all network files as |Selections| (stored in module |pub|)
        and assign the "complete" selection to the |HydPy| object."""
        pub.selections = selectiontools.Selections()
        pub.selections += pub.networkmanager.load_files()
        self.update_devices(pub.selections.complete)

    def init_models(self):
        """Call method |Element.init_model| of all |Element| objects
        currently handled by the |HydPy| object."""
        self.elements.init_models()

    def save_controls(self, controldir=None, projectdir=None,
                      parameterstep=None, simulationstep=None,
                      auxfiler=None):
        """Call method |Elements.save_controls| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.save_controls(controldir=controldir,
                                    projectdir=projectdir,
                                    parameterstep=parameterstep,
                                    simulationstep=simulationstep,
                                    auxfiler=auxfiler)

    def load_conditions(self, conditiondir=None, projectdir=None):
        """Call method |Elements.load_conditions| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.load_conditions(conditiondir=conditiondir,
                                      projectdir=projectdir)

    def save_conditions(self, conditiondir=None, projectdir=None,
                        controldir=None):
        """Call method |Elements.save_conditions| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.save_conditions(conditiondir=conditiondir,
                                      projectdir=projectdir,
                                      controldir=controldir)

    def trim_conditions(self):
        """Call method |Elements.trim_conditions| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.trim_conditions()

    def reset_conditions(self):
        """Call method |Elements.reset_conditions| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.reset_conditions()

    def connect(self):
        """Call method |Elements.connect| of the |Elements| object currently
        handled by the |HydPy| object."""
        self.elements.connect()

    @property
    def networkproperties(self):
        """Print out some properties of the network defined by the |Node| and
        |Element| objects currently handled by the |HydPy| object."""
        print('Number of nodes: %d' % len(self.nodes))
        print('Number of elements: %d' % len(self.elements))
        print('Number of end nodes: %d' % len(self.endnodes))
        print('Number of distinct networks: %d' % len(self.numberofnetworks))
        print('Applied node variables: %s' % ', '.join(self.variables))

    @property
    def numberofnetworks(self):
        """The number of distinct networks defined by the|Node| and
        |Element| objects currently handled by the |HydPy| object."""
        sels1 = selectiontools.Selections()
        sels2 = selectiontools.Selections()
        complete = selectiontools.Selection('complete',
                                            self.nodes, self.elements)
        for node in self.endnodes:
            sel = complete.copy(node.name).select_upstream(node)
            sels1 += sel
            sels2 += sel.copy(node.name)
        for sel1 in sels1:
            for sel2 in sels2:
                if sel1.name != sel2.name:
                    sel1 -= sel2
        for name in list(sels1.names):
            if not sels1[name].elements:
                del sels1[name]
        return sels1

    def _update_deviceorder(self):
        self.deviceorder = []
        for node in self.endnodes:
            self._nextnode(node)
        self.deviceorder = self.deviceorder[::-1]

    def _nextnode(self, node):
        for element in node.exits:
            if ((element in self.elements) and
                    (element not in self.deviceorder)):
                if node not in element.receivers:
                    self._nextelement(element)
        if (node in self.nodes) and (node not in self.deviceorder):
            self.deviceorder.append(node)
            for element in node.entries:
                self._nextelement(element)

    def _nextelement(self, element):
        for node in element.outlets:
            if ((node in self.nodes) and
                    (node not in self.deviceorder)):
                self._nextnode(node)
        if (element in self.elements) and (element not in self.deviceorder):
            self.deviceorder.append(element)
            for node in element.inlets:
                self._nextnode(node)

    @property
    def endnodes(self):
        """|Nodes| object containing all |Node| objects currently handled by
        the |HydPy| object which define a downstream end point of a network."""
        endnodes = devicetools.Nodes()
        for node in self.nodes:
            for element in node.exits:
                if ((element in self.elements) and
                        (node not in element.receivers)):
                    break
            else:
                endnodes += node
        return endnodes

    @property
    def variables(self):
        """Sorted list of strings summarizing all variables handled by the
        |Node| objects"""
        variables = set([])
        for node in self.nodes:
            variables.add(node.variable)
        return sorted(variables)

    @property
    def simindices(self):
        """Tuple containing the start and end index of the simulation period
        regarding the initialization period defined by the |Timegrids| object
        stored in module |pub|."""
        return (pub.timegrids.init[pub.timegrids.sim.firstdate],
                pub.timegrids.init[pub.timegrids.sim.lastdate])

    def open_files(self, idx=0):
        """Call method |Devices.open_files| of the |Nodes| and |Elements|
        objects currently handled by the |HydPy| object."""
        self.elements.open_files(idx=idx)
        self.nodes.open_files(idx=idx)

    def close_files(self):
        """Call method |Devices.close_files| of the |Nodes| and |Elements|
        objects currently handled by the |HydPy| object."""
        self.elements.close_files()
        self.nodes.close_files()

    def update_devices(self, selection=None):
        """Determines the order, in which the |Node| and |Element| objects
        currently handled by the |HydPy| objects need to be processed during
        a simulation time step.  Optionally, a |Selection| object for defining
        new |Node| and |Element| objects can be passed."""
        if selection is not None:
            self.nodes = selection.nodes
            self.elements = selection.elements
        self._update_deviceorder()

    @property
    def methodorder(self):
        """A list containing all methods of all |Node| and |Element| objects
        that need to be processed during a simulation time step in the
        order they must be called."""
        # Some private methods of other classes are called.  The wrong usage
        # of these method could cause segmentation faults in Cython mode.
        # Hence it seems to be a good idea to make them "invisible" for
        # novice users via declaring them as private:
        # pylint: disable=protected-access
        funcs = []
        for node in self.nodes:
            if node.deploymode == 'oldsim':
                funcs.append(node._load_data_sim)
            elif node.sequences.obs.use_ext:
                funcs.append(node._load_data_obs)
        for node in self.nodes:
            if node.deploymode != 'oldsim':
                funcs.append(node.reset)
        for device in self.deviceorder:
            if isinstance(device, abctools.ElementABC):
                funcs.append(device.model.doit)
        for element in self.elements:
            if element.senders:
                funcs.append(element.model.update_senders)
        for element in self.elements:
            if element.receivers:
                funcs.append(element.model.update_receivers)
        for element in self.elements:
            funcs.append(element.model.save_data)
        for node in self.nodes:
            if node.deploymode != 'oldsim':
                funcs.append(node._save_data_sim)
        return funcs

    @printtools.print_progress
    def doit(self):
        """Perform a simulation run over the actual simulation time period
        defined by the |Timegrids| object stored in module |pub|."""
        idx_start, idx_end = self.simindices
        self.open_files(idx_start)
        methodorder = self.methodorder
        for idx in printtools.progressbar(range(idx_start, idx_end)):
            for func in methodorder:
                func(idx)
        self.close_files()

    def prepare_modelseries(self, ramflag=True):
        """Call method |Elements.prepare_allseries| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.prepare_allseries(ramflag=ramflag)

    def prepare_inputseries(self, ramflag=True):
        """Call method |Elements.prepare_inputseries| of the |Elements|
        object currently handled by the |HydPy| object."""
        self.elements.prepare_inputseries(ramflag=ramflag)

    def prepare_fluxseries(self, ramflag=True):
        """Call method |Elements.prepare_fluxseries| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.prepare_fluxseries(ramflag=ramflag)

    def prepare_stateseries(self, ramflag=True):
        """Call method |Elements.prepare_stateseries| of the |Elements|
        object currently handled by the |HydPy| object."""
        self.elements.prepare_stateseries(ramflag=ramflag)

    def prepare_nodeseries(self, ramflag=True):
        """Call method |Nodes.prepare_allseries| of the |Nodes| object
        currently handled by the |HydPy| object."""
        self.nodes.prepare_allseries(ramflag=ramflag)

    def prepare_simseries(self, ramflag=True):
        """Call method |Nodes.prepare_simseries| of the |Nodes| object
        currently handled by the |HydPy| object."""
        self.nodes.prepare_simseries(ramflag=ramflag)

    def prepare_obsseries(self, ramflag=True):
        """Call method |Nodes.prepare_obsseries| of the |Nodes| object
        currently handled by the |HydPy| object."""
        self.nodes.prepare_obsseries(ramflag=ramflag)

    def save_modelseries(self):
        """Call method |Elements.save_allseries| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.save_allseries()

    def save_inputseries(self):
        """Call method |Elements.save_inputseries| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.save_inputseries()

    def save_fluxseries(self):
        """Call method |Elements.save_fluxseries| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.save_fluxseries()

    def save_stateseries(self):
        """Call method |Elements.save_stateseries| of the |Elements| object
        currently handled by the |HydPy| object."""
        self.elements.save_stateseries()

    def save_nodeseries(self):
        """Call method |Nodes.save_allseries| of the |Nodes| object currently
        handled by the |HydPy| object."""
        self.nodes.save_allseries()

    def save_simseries(self):
        """Call method |Nodes.save_simseries| of the |Nodes| object currently
        handled by the |HydPy| object."""
        self.nodes.save_simseries()

    def save_obsseries(self):
        """Call method |Nodes.save_obsseries| of the |Nodes| object currently
        handled by the |HydPy| object."""
        self.nodes.save_obsseries()


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/importtools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
# -*- coding: utf-8 -*-
"""This module implements features related to importing models.

The implemented tools are primarily designed hiding model initialization
routines from model users and for allowing writing readable doctests.
"""
# import...
# ...from the Python standard library
from __future__ import division, print_function
import os
import inspect
import warnings
# ...from HydPy
from hydpy import pub
from hydpy.core import autodoctools
from hydpy.core import filetools
from hydpy.core import objecttools
from hydpy.core import parametertools
from hydpy.core import sequencetools
from hydpy.core import timetools


def parameterstep(timestep=None):
    """Define a parameter time step size within a parameter control file.

    Argument:
      * timestep(|Period|): Time step size.

    Function parameterstep should usually be be applied in a line
    immediately behind the model import.  Defining the step size of time
    dependent parameters is a prerequisite to access any model specific
    parameter.

    Note that parameterstep implements some namespace magic by
    means of the module |inspect|.  This makes things a little
    complicated for framework developers, but it eases the definition of
    parameter control files for framework users.
    """
    if timestep is not None:
        parametertools.Parameter.parameterstep(timetools.Period(timestep))
    namespace = inspect.currentframe().f_back.f_locals
    model = namespace.get('model')
    if model is None:
        model = namespace['Model']()
        namespace['model'] = model
        if pub.options.usecython and 'cythonizer' in namespace:
            cythonizer = namespace['cythonizer']
            namespace['cythonmodule'] = cythonizer.cymodule
            model.cymodel = cythonizer.cymodule.Model()
            namespace['cymodel'] = model.cymodel
            model.cymodel.parameters = cythonizer.cymodule.Parameters()
            model.cymodel.sequences = cythonizer.cymodule.Sequences()
            for numpars_name in ('NumConsts', 'NumVars'):
                if hasattr(cythonizer.cymodule, numpars_name):
                    numpars_new = getattr(cythonizer.cymodule, numpars_name)()
                    numpars_old = getattr(model, numpars_name.lower())
                    for (name_numpar, numpar) in vars(numpars_old).items():
                        setattr(numpars_new, name_numpar, numpar)
                    setattr(model.cymodel, numpars_name.lower(), numpars_new)
            for name in dir(model.cymodel):
                if (not name.startswith('_')) and hasattr(model, name):
                    setattr(model, name, getattr(model.cymodel, name))
        if 'Parameters' not in namespace:
            namespace['Parameters'] = parametertools.Parameters
        model.parameters = namespace['Parameters'](namespace)
        if 'Sequences' not in namespace:
            namespace['Sequences'] = sequencetools.Sequences
        model.sequences = namespace['Sequences'](**namespace)
        namespace['parameters'] = model.parameters
        for pars in model.parameters:
            namespace[pars.name] = pars
        namespace['sequences'] = model.sequences
        for seqs in model.sequences:
            namespace[seqs.name] = seqs
    try:
        namespace.update(namespace['CONSTANTS'])
    except KeyError:
        pass
    focus = namespace.get('focus')
    for par in model.parameters.control:
        try:
            if (focus is None) or (par is focus):
                namespace[par.name] = par
            else:
                namespace[par.name] = lambda *args, **kwargs: None
        except AttributeError:
            pass


def reverse_model_wildcard_import():
    """Clear the local namespace from a model wildcard import.

    Calling this method should remove the critical imports into the local
    namespace due the last wildcard import of a certain application model.
    It is thought for securing the successive preperation of different
    types of models via wildcard imports.  See the following example, on
    how it can be applied.

    >>> from hydpy import reverse_model_wildcard_import

    Assume you wildcard import the first version of HydPy-L-Land (|lland_v1|):

    >>> from hydpy.models.lland_v1 import *

    This for example adds the collection class for handling control
    parameters of `lland_v1` into the local namespace:

    >>> print(ControlParameters(None).name)
    control

    Calling function |parameterstep| for example prepares the control
    parameter object |lland_control.NHRU|:

    >>> parameterstep('1d')
    >>> nhru
    nhru(-999999)

    Calling function |reverse_model_wildcard_import| removes both
    objects (and many more, but not all) from the local namespace:

    >>> reverse_model_wildcard_import()

    >>> ControlParameters
    Traceback (most recent call last):
    ...
    NameError: name 'ControlParameters' is not defined

    >>> nhru
    Traceback (most recent call last):
    ...
    NameError: name 'nhru' is not defined
    """
    namespace = inspect.currentframe().f_back.f_locals
    model = namespace.get('model')
    if model is not None:
        for subpars in model.parameters:
            for par in subpars:
                namespace.pop(par.name, None)
                namespace.pop(objecttools.classname(par), None)
            namespace.pop(subpars.name, None)
            namespace.pop(objecttools.classname(subpars), None)
        for subseqs in model.sequences:
            for seq in subseqs:
                namespace.pop(seq.name, None)
                namespace.pop(objecttools.classname(seq), None)
            namespace.pop(subseqs.name, None)
            namespace.pop(objecttools.classname(subseqs), None)
        for name in ('parameters', 'sequences', 'model',
                     'Parameters', 'Sequences', 'Model',
                     'cythonizer', 'cymodel', 'cythonmodule'):
            namespace.pop(name, None)
        for key in list(namespace.keys()):
            try:
                if namespace[key].__module__ == model.__module__:
                    del namespace[key]
            except AttributeError:
                pass


def prepare_model(module, timestep=None):
    """Prepare and return the model of the given module.

    In usual HydPy projects, each hydrological model instance is prepared
    in an individual control file.  This allows for "polluting" the
    namespace with different model attributes.  There is no danger of
    name conflicts, as long as no other (wildcard) imports are performed.

    However, there are situations when different models are to be loaded
    into the same namespace.  Then it is advisable to use function
    |prepare_model|, which just returns a reference to the model
    and nothing else.

    See the documentation of |dam_v001| on how to apply function
    |prepare_model| properly.
    """
    if timestep is not None:
        parametertools.Parameter.parameterstep(timetools.Period(timestep))
    model = module.Model()
    if pub.options.usecython and hasattr(module, 'cythonizer'):
        cymodule = module.cythonizer.cymodule
        cymodel = cymodule.Model()
        cymodel.parameters = cymodule.Parameters()
        cymodel.sequences = cymodule.Sequences()
        model.cymodel = cymodel
        for numpars_name in ('NumConsts', 'NumVars'):
            if hasattr(cymodule, numpars_name):
                numpars_new = getattr(cymodule, numpars_name)()
                numpars_old = getattr(model, numpars_name.lower())
                for (name_numpar, numpar) in vars(numpars_old).items():
                    setattr(numpars_new, name_numpar, numpar)
                setattr(cymodel, numpars_name.lower(), numpars_new)
        for name in dir(cymodel):
            if (not name.startswith('_')) and hasattr(model, name):
                setattr(model, name, getattr(cymodel, name))
        dict_ = {'cythonmodule': cymodule,
                 'cymodel': cymodel}
    else:
        dict_ = {}
    dict_.update(vars(module))
    dict_['model'] = model
    if hasattr(module, 'Parameters'):
        model.parameters = module.Parameters(dict_)
    else:
        model.parameters = parametertools.Parameters(dict_)
    if hasattr(module, 'Sequences'):
        model.sequences = module.Sequences(**dict_)
    else:
        model.sequences = sequencetools.Sequences(**dict_)
    return model


def simulationstep(timestep):
    """
    Define a simulation time step size for testing purposes within a
    parameter control file.

    Using |simulationstep| only affects the values of time dependent
    parameters, when `pub.timegrids.stepsize` is not defined.  It thus has
    no influence on usual hydpy simulations at all.  Use it just to check
    your parameter control files.  Write it in a line immediately behind
    the one calling |parameterstep|.
    """
    if pub.options.warnsimulationstep:
        warnings.warn(
            'Note that the applied function `simulationstep` is inteded for '
            'testing purposes only.  When doing a hydpy simulation, parameter '
            'values are initialized based on the actual simulation time step '
            'as defined under `pub.timegrids.stepsize` and the value given '
            'to `simulationstep` is ignored.')
    parametertools.Parameter.simulationstep(timetools.Period(timestep))


def controlcheck(controldir='default', projectdir=None, controlfile=None):
    namespace = inspect.currentframe().f_back.f_locals
    model = namespace.get('model')
    if model is None:
        if not controlfile:
            controlfile = os.path.split(namespace['__file__'])[-1]
        os.chdir('..')
        os.chdir('..')
        controlmanager = filetools.ControlManager()
        if projectdir:
            controlmanager.projectdir = projectdir
        else:
            controlmanager.projectdir = os.path.split(os.getcwd())[-1]
        controlmanager.currentdir = controldir
        os.chdir('..')
        model = controlmanager.load_file(filename=controlfile)['model']
        model.parameters.update()
        namespace['model'] = model
        for name in ('states', 'logs'):
            subseqs = getattr(model.sequences, name, None)
            if subseqs is not None:
                for seq in subseqs:
                    namespace[seq.name] = seq


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/indextools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
# -*- coding: utf-8 -*-
"""This module implements tools to determine time related indices."""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...from HydPy
from hydpy import pub
from hydpy.core import objecttools
from hydpy.core import timetools
from hydpy.core import autodoctools


class Indexer(object):
    """Handles arrays containing indexes.

    One can specify the index arrays manually, but usually they are
    determined automatically based on the |Timegrids| object made
    available through module |pub|.
    """
    def __init__(self):
        self._monthofyear = None
        self._monthofyear_hash = hash(None)
        self._dayofyear = None
        self._dayofyear_hash = hash(None)
        self._timeofyear = None
        self._timeofyear_hash = hash(None)

    def _getmonthofyear(self):
        """Month of the year index (January = 0...)."""
        from hydpy.pub import timegrids
        if ((self._monthofyear is None) or
                (hash(timegrids) != self._monthofyear_hash)):
            def monthofyear(date):
                return date.month-1
            self._monthofyear = self._calcidxs(monthofyear)
            self._monthofyear_hash = hash(timegrids)
        return self._monthofyear

    def _setmonthofyear(self, values):
        from hydpy.pub import timegrids
        self._monthofyear = self._convertandtest(values, 'monthofyear')
        self._monthofyear_hash = hash(timegrids)

    def _delmonthofyear(self):
        self._monthofyear = None

    monthofyear = property(_getmonthofyear, _setmonthofyear, _delmonthofyear)

    def _getdayofyear(self):
        """Day of the year index (the first of January = 0...).

        For reasons of consistency between leap years and non-leap years,
        assuming a daily time step, index 59 is always associated with the
        29th of February.  Hence, it is missing in non-leap years:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> from hydpy.core.indextools import Indexer
        >>> pub.timegrids = Timegrids(Timegrid('27.02.2004',
        ...                                    '3.03.2004',
        ...                                    '1d'))
        >>> Indexer().dayofyear
        array([57, 58, 59, 60, 61])
        >>> pub.timegrids = Timegrids(Timegrid('27.02.2005',
        ...                                    '3.03.2005',
        ...                                    '1d'))
        >>> Indexer().dayofyear
        array([57, 58, 60, 61])
        """
        if ((self._dayofyear is None) or
                (hash(pub.timegrids) != self._dayofyear_hash)):
            def dayofyear(date):
                return (date.dayofyear-1 +
                        ((date.month > 2) and (not date.leapyear)))
            self._dayofyear = self._calcidxs(dayofyear)
            self._dayofyear_hash = hash(pub.timegrids)
        return self._dayofyear

    def _setdayofyear(self, values):
        self._dayofyear = self._convertandtest(values, 'dayofyear')
        self._dayofyear_hash = hash(pub.timegrids)

    def _deldayofyear(self):
        self._dayofyear = None

    dayofyear = property(_getdayofyear, _setdayofyear, _deldayofyear)

    def _gettimeofyear(self):
        """Time of the year index (first simulation step of each year = 0...).

        The property |Indexer.timeofyear| is best explained through
        comparing it with property |Indexer.dayofyear|:

        Let us reconsider one of the examples of the documentation on
        property |Indexer.dayofyear|:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> from hydpy.core.indextools import Indexer
        >>> pub.timegrids = Timegrids(Timegrid('27.02.2005',
        ...                                    '3.03.2005',
        ...                                    '1d'))

        Due to the simulation stepsize being one day, the index arrays
        calculated by both properties are identical:

        >>> Indexer().dayofyear
        array([57, 58, 60, 61])
        >>> Indexer().timeofyear
        array([57, 58, 60, 61])

        In the next example the step size is halved:

        >>> pub.timegrids = Timegrids(Timegrid('27.02.2005',
        ...                                    '3.03.2005',
        ...                                    '12h'))

        Now the there a generally two subsequent simulation steps associated
        with the same day:

        >>> Indexer().dayofyear
        array([57, 57, 58, 58, 60, 60, 61, 61])

        However, the `timeofyear` array gives the index of the
        respective simulation steps of the actual year:

        >>> Indexer().timeofyear
        array([114, 115, 116, 117, 120, 121, 122, 123])

        Note the gap in the returned index array due to 2005 being not a
        leap year.
        """
        if ((self._timeofyear is None) or
                (hash(pub.timegrids) != self._timeofyear_hash)):
            if pub.timegrids is None:
                refgrid = None
            else:
                refgrid = timetools.Timegrid(timetools.Date('2000.01.01'),
                                             timetools.Date('2001.01.01'),
                                             pub.timegrids.stepsize)

            def timeofyear(date):
                date = date.copy()
                date.year = 2000
                return refgrid[date]

            self._timeofyear = self._calcidxs(timeofyear)
            self._timeofyear_hash = hash(pub.timegrids)
        return self._timeofyear

    def _settimeofyear(self, values):
        self._timeofyear = self._convertandtest(values, 'timeofyear')
        self._timeofyear_hash = hash(pub.timegrids)

    def _deltimeofyear(self):
        self._timeofyear = None

    timeofyear = property(_gettimeofyear, _settimeofyear, _deltimeofyear)

    def _convertandtest(self, values, name):
        """Try to convert the given values to a |numpy| |numpy.ndarray| and
        check if it is plausible.  If so, return the array, other raise
        a |ValueError| or re-raise a |numpy| specific exception.
        """
        try:
            array = numpy.array(values, dtype=int)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to assign a new `%s` '
                'index array to an Indexer object'
                % name)
        if array.ndim != 1:
            raise ValueError(
                'The `%s` index array of an Indexer object must be '
                '1-dimensional.  However, the given value has interpreted '
                'as a %d-dimensional object.'
                % (name, array.ndim))
        if pub.timegrids is not None:
            if len(array) != len(pub.timegrids.init):
                raise ValueError(
                    'The %s` index array of an Indexer object must have a '
                    'number of entries fitting to the initialization time '
                    'period precisely.  However, the given value has been '
                    'interpreted to be of length %d and the length of the '
                    'Timegrid object representing the actual initialization '
                    'time period is %d.'
                    % (name, len(array), len(pub.timegrids.init)))
        return array

    def _calcidxs(self, func):
        """Return the required indexes based on the given lambda function
        and the |Timegrids| object handled by module |pub|.  Raise a
        |RuntimeError| if the latter is not available.
        """
        if pub.timegrids is None:
            raise RuntimeError(
                'An Indexer object has been asked for an %s array.  Such an '
                'array has neither been determined yet nor can it be '
                'determined automatically at the moment.   Either define an '
                '%s array manually and pass it to the Indexer object, or make '
                'a proper Timegrids object available within the pub module.  '
                'In usual HydPy applications, the latter is done '
                'automatically.'
                % (func.__name__, func.__name__))
        idxs = numpy.empty(len(pub.timegrids.init), dtype=int)
        for (jdx, date) in enumerate(pub.timegrids.init):
            idxs[jdx] = func(date)
        return idxs


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/modelimports.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
"""This module bundles imports generally required for implementing new models.

Module |modelimports| is supposed to shorten the import section
of base and application models implemented.  Just write:

>>> from hydpy.core.modelimports import *

Thereafter, the following objects are available:
 * module |numpy|
 * numpys |numpy.nan| and |numpy.inf|
 * functions |parameterstep|, |simulationstep|, and |controlcheck|
   of module |importtools|
 * class |Tester| of module |testtools|
 * class |Cythonizer| of module |modelutils|

"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...third party
import numpy
from numpy import nan
from numpy import inf
# ...HydPy specific
# Load the required `magic` functions into the local namespace.
from hydpy.core.importtools import parameterstep
from hydpy.core.importtools import simulationstep
from hydpy.core.importtools import controlcheck
from hydpy.core.autodoctools import autodoc_basemodel
from hydpy.core.autodoctools import autodoc_applicationmodel
from hydpy.core.testtools import Tester
from hydpy.cythons.modelutils import Cythonizer

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/modeltools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
# -*- coding: utf-8 -*-
"""This module implements tools for the development of hydrological models.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import os
import types
# ...from site-packages
import numpy
# ...from HydPy
from hydpy import conf
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import objecttools
from hydpy.cythons import modelutils


class _MetaModel(type):

    def __new__(cls, cls_name, cls_parents, dict_):
        _METHOD_GROUPS = ('_RUN_METHODS', '_ADD_METHODS',
                          '_INLET_METHODS', '_OUTLET_METHODS',
                          '_RECEIVER_METHODS', '_SENDER_METHODS',
                          '_PART_ODE_METHODS', '_FULL_ODE_METHODS')
        dict_['_METHOD_GROUPS'] = _METHOD_GROUPS
        for method_name in _METHOD_GROUPS:
            methods = dict_.get(method_name, ())
            if methods:
                if method_name == '_RUN_METHODS':
                    lst = ['\n\n\n    The following "run methods" are called '
                           'each simulation step run in the given sequence:']
                elif method_name == '_ADD_METHODS':
                    lst = ['\n\n\n    The following "additional methods" are '
                           'called by at least one "run method":']
                elif method_name == '_INLET_METHODS':
                    lst = ['\n\n\n    The following "inlet update methods" '
                           'are called in the given sequence immediately  '
                           'before solving the differential equations '
                           'of the respective model:']
                elif method_name == '_OUTLET_METHODS':
                    lst = ['\n\n\n    The following "outlet update methods" '
                           'are called in the given sequence immediately  '
                           'after solving the differential equations '
                           'of the respective model:']
                elif method_name == '_RECEIVER_METHODS':
                    lst = ['\n\n\n    The following "receiver update methods" '
                           'are called in the given sequence before solving '
                           'the differential equations of any model:']
                elif method_name == '_SENDER_METHODS':
                    lst = ['\n\n\n    The following "sender update methods" '
                           'are called in the given sequence after solving '
                           'the differential equations of all models:']
                elif method_name == '_PART_ODE_METHODS':
                    lst = ['\n\n\n    The following methods define the '
                           'relevant components of a system of ODE '
                           'equations (e.g. direct runoff):']
                elif method_name == '_FULL_ODE_METHODS':
                    lst = ['\n\n\n    The following methods define the '
                           'complete equations of an ODE system '
                           '(e.g. change in storage of `fast water` due to '
                           ' effective precipitation and direct runoff):']
                for method in methods:
                    lst.append('      * :func:`~%s` %s'
                               % ('.'.join((method.__module__,
                                            method.__name__)),
                                  autodoctools.description(method)))
                doc = dict_.get('__doc__', 'Undocumented model.')
                dict_['__doc__'] = doc + '\n'.join(l for l in lst)

        return type.__new__(cls, cls_name, cls_parents, dict_)


_MetaModel_ = _MetaModel('_MetaModel', (), {})


class Model(_MetaModel_):
    """Base class for all hydrological models."""

    NUMERICAL = False

    _RUN_METHODS = ()
    _ADD_METHODS = ()
    _INLET_METHODS = ()
    _OUTLET_METHODS = ()
    _RECEIVER_METHODS = ()
    _SENDER_METHODS = ()
    _PART_ODE_METHODS = ()
    _FULL_ODE_METHODS = ()

    def __init__(self):
        self.element = None
        self.parameters = None
        self.sequences = None
        self.cymodel = objecttools.FastAccess()
        self.cymodel.idx_sim = -999
        self._init_methods()

    def _init_methods(self):
        """Convert all pure Python calculation functions of the model class to
        methods and assign them to the model instance.
        """
        for name_group in self._METHOD_GROUPS:
            functions = getattr(self, name_group, ())
            uniques = {}
            for func in functions:
                name_func = func.__name__
                method = types.MethodType(func, self)
                setattr(self, name_func, method)
                shortname = '_'.join(name_func.split('_')[:-1])
                if shortname in uniques:
                    uniques[shortname] = None
                else:
                    uniques[shortname] = method
            for (shortname, method) in uniques.items():
                if method is not None:
                    setattr(self, shortname, method)

    def connect(self):
        """Connect the link sequences of the actual model."""
        try:
            for group in ('inlets', 'receivers', 'outlets', 'senders'):
                self._connect_subgroup(group)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to build the node connection of the `%s` '
                'sequences of the model handled by element `%s`'
                % (group[:-1], objecttools.devicename(self)))

    def _connect_subgroup(self, group):
        available_nodes = getattr(self.element, group).slaves
        links = getattr(self.sequences, group, ())
        applied_nodes = []
        for seq in links:
            selected_nodes = tuple(node for node in available_nodes
                                   if node.variable.lower() == seq.name)
            if seq.NDIM == 0:
                if len(selected_nodes) == 1:
                    applied_nodes.append(selected_nodes[0])
                    seq.set_pointer(selected_nodes[0].get_double(group))
                elif len(selected_nodes) == 0:
                    raise RuntimeError(
                        'Sequence `%s` cannot be connected, as no node is '
                        'available which is handling the variable `%s`.'
                        % (seq.name, seq.name.upper()))
                else:
                    raise RuntimeError(
                        'Sequence `%s` cannot be connected, as it is '
                        '0-dimensional but multiple nodes are available '
                        'which are handling variable `%s`.'
                        % (seq.name, seq.seq.name.upper()))
            elif seq.NDIM == 1:
                seq.shape = len(selected_nodes)
                for idx, node in enumerate(selected_nodes):
                    applied_nodes.append(node)
                    seq.set_pointer(node.get_double(group), idx)
        if len(applied_nodes) < len(available_nodes):
            remaining_nodes = [node.name for node in available_nodes
                               if node not in applied_nodes]
            raise RuntimeError(
                'The following nodes have not been connected '
                'to any sequences: `%s`.'
                % ', '.join(remaining_nodes))

    def doit(self, idx):
        self.idx_sim = idx
        self.load_data()
        self.update_inlets()
        self.run()
        self.new2old()
        self.update_outlets()

    def run(self):
        for method in self._RUN_METHODS:
            method(self)

    def load_data(self):
        self.sequences.load_data(self.idx_sim)

    def save_data(self, idx):
        self.idx_sim = idx
        self.sequences.save_data(idx)

    def update_inlets(self):
        for method in self._INLET_METHODS:
            method(self)

    def update_outlets(self):
        for method in self._OUTLET_METHODS:
            method(self)

    def update_receivers(self, idx):
        self.idx_sim = idx
        for method in self._RECEIVER_METHODS:
            method(self)

    def update_senders(self, idx):
        self.idx_sim = idx
        for method in self._SENDER_METHODS:
            method(self)

    def new2old(self):
        """Assign the new/final state values of the actual time step to the
        new/initial state values of the next time step.  Needs to be
        overwritten in Cython mode.
        """
        try:
            self.sequences.states.new2old()
        except AttributeError:
            pass

    def _getidx_sim(self):
        """Index of the actual simulation time step."""
        return self.cymodel.idx_sim

    def _setidx_sim(self, value):
        self.cymodel.idx_sim = int(value)

    idx_sim = property(_getidx_sim, _setidx_sim)

    def __str__(self):
        return self.__module__.split('.')[2]

    def __dir__(self):
        return objecttools.dir_(self)


abctools.ModelABC.register(Model)


class NumConstsELS(object):

    def __init__(self):
        self.nmb_methods = 10
        self.nmb_stages = 11
        self.dt_increase = 2.
        self.dt_decrease = 10.
        path = os.path.join(conf.__path__[0],
                            'a_coefficients_explicit_lobatto_sequence.npy')
        self.a_coefs = numpy.load(path)


class NumVarsELS(object):

    def __init__(self):
        self.nmb_calls = 0
        self.t0 = 0.
        self.t1 = 0.
        self.dt_est = 1.
        self.dt = 1.
        self.idx_method = 0
        self.idx_stage = 0
        self.error = 0.
        self.last_error = 0.
        self.extrapolated_error = 0.
        self.f0_ready = False


class ModelELS(Model):

    NUMERICAL = True

    def __init__(self):
        Model.__init__(self)
        self.numconsts = NumConstsELS()
        self.numvars = NumVarsELS()

    def doit(self, idx):
        self.idx_sim = idx
        self.load_data()
        self.update_inlets()
        self.solve()
        self.update_outlets()

    def solve(self):
        """

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> k(0.0)
        >>> solver.abserrormax = 1e-2
        >>> solver.reldtmin = 1e-4
        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(1.0)
        >>> fluxes.q
        q(0.0)
        >>> model.numvars.idx_method
        2
        >>> model.numvars.dt
        1.0
        >>> model.numvars.nmb_calls
        2

        >>> k(0.1)
        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.905)
        >>> fluxes.q
        q(0.095)
        >>> model.numvars.idx_method
        2
        >>> model.numvars.nmb_calls
        2

        >>> import numpy
        >>> from hydpy import round_
        >>> round_(numpy.exp(-k))
        0.904837

        >>> solver.abserrormax = 1e-3

        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.904833)
        >>> fluxes.q
        q(0.095167)
        >>> model.numvars.idx_method
        3
        >>> model.numvars.nmb_calls
        4

        >>> solver.abserrormax = 1e-4

        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.904837)
        >>> fluxes.q
        q(0.095163)
        >>> model.numvars.idx_method
        4
        >>> model.numvars.nmb_calls
        7

        >>> solver.abserrormax = 1e-12

        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.904837)
        >>> fluxes.q
        q(0.095163)
        >>> model.numvars.idx_method
        8
        >>> model.numvars.nmb_calls
        29

        >>> solver.abserrormax = 1e-2

        >>> k(0.5)

        >>> round_(numpy.exp(-k))
        0.606531

        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.606771)
        >>> fluxes.q
        q(0.393229)
        >>> model.numvars.idx_method
        4
        >>> model.numvars.nmb_calls
        7

        >>> k(2.0)

        >>> round_(numpy.exp(-k))
        0.135335

        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.134658)
        >>> fluxes.q
        q(0.865342)
        >>> model.numvars.nmb_calls
        22

        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.018929)
        >>> fluxes.q
        q(0.115728)
        >>> model.numvars.nmb_calls
        13

        >>> k(4.0)

        >>> round_(numpy.exp(-k))
        0.018316

        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.019774)
        >>> fluxes.q
        q(0.980226)
        >>> round_(model.numvars.dt)
        0.3
        >>> model.numvars.nmb_calls
        44

        >>> from hydpy import reverse_model_wildcard_import
        >>> reverse_model_wildcard_import()

        >>> from hydpy.models.test_v2 import *
        >>> parameterstep()
        >>> k(0.5)
        >>> solver.abserrormax = 1e-2
        >>> solver.reldtmin = 1e-4
        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(0.5)
        >>> fluxes.q
        q(0.5)
        >>> model.numvars.idx_method
        2
        >>> model.numvars.dt
        1.0
        >>> model.numvars.nmb_calls
        2

        >>> k(2.0)
        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(-0.006827)
        >>> fluxes.q
        q(1.006827)
        >>> model.numvars.nmb_calls
        58

        >>> k(2.1)
        >>> states.s(1.0)
        >>> model.numvars.nmb_calls = 0
        >>> model.solve()
        >>> states.s
        s(-0.00072)
        >>> fluxes.q
        q(1.00072)
        >>> model.numvars.nmb_calls
        50

        """
        self.numvars.t0, self.numvars.t1 = 0., 1.
        self.numvars.dt_est = 1.
        self.numvars.f0_ready = False
        self.reset_sum_fluxes()
        while self.numvars.t0 < self.numvars.t1-1e-14:
            self.numvars.last_error = 999999.
            self.numvars.dt = min(
                self.numvars.t1-self.numvars.t0,
                max(self.numvars.dt_est, self.parameters.solver.reldtmin))
            if not self.numvars.f0_ready:
                self.calculate_single_terms()
                self.numvars.idx_method = 0
                self.numvars.idx_stage = 0
                self.set_point_fluxes()
                self.set_point_states()
                self.set_result_states()
            for self.numvars.idx_method in range(
                    1, self.numconsts.nmb_methods+1):
                for self.numvars.idx_stage in range(
                        1, self.numvars.idx_method):
                    self.get_point_states()
                    self.calculate_single_terms()
                    self.set_point_fluxes()
                for self.numvars.idx_stage in range(
                        1, self.numvars.idx_method+1):
                    self.integrate_fluxes()
                    self.calculate_full_terms()
                    self.set_point_states()
                self.set_result_fluxes()
                self.set_result_states()
                self.calculate_error()
                self.extrapolate_error()
                if self.numvars.idx_method == 1:
                    continue
                elif self.numvars.error <= self.parameters.solver.abserrormax:
                    self.numvars.dt_est = (self.numconsts.dt_increase *
                                           self.numvars.dt)
                    self.numvars.f0_ready = False
                    self.addup_fluxes()
                    self.numvars.t0 = self.numvars.t0+self.numvars.dt
                    self.new2old()
                    break
                elif ((self.numvars.extrapolated_error >
                       self.parameters.solver.abserrormax) and
                      (self.numvars.dt > self.parameters.solver.reldtmin)):
                    self.numvars.f0_ready = True
                    self.numvars.dt_est = (self.numvars.dt /
                                           self.numconsts.dt_decrease)
                    break
                else:
                    self.numvars.last_error = self.numvars.error
                    self.numvars.f0_ready = True
                    continue
            else:
                if self.numvars.dt <= self.parameters.solver.reldtmin:
                    self.numvars.f0_ready = False
                    self.addup_fluxes()
                    self.numvars.t0 = self.numvars.t0+self.numvars.dt
                    self.new2old()
                else:
                    self.numvars.f0_ready = True
                    self.numvars.dt_est = (self.numvars.dt /
                                           self.numconsts.dt_decrease)
        self.get_sum_fluxes()

    def calculate_single_terms(self):
        """Apply all methods stored in the hidden attribute
        `_PART_ODE_METHODS`.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> k(0.25)
        >>> states.s = 1.0
        >>> model.calculate_single_terms()
        >>> fluxes.q
        q(0.25)
        """
        self.numvars.nmb_calls = self.numvars.nmb_calls+1
        for method in self._PART_ODE_METHODS:
            method(self)

    def calculate_full_terms(self):
        """
        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> k(0.25)
        >>> states.s.old = 1.0
        >>> fluxes.q = 0.25
        >>> model.calculate_full_terms()
        >>> states.s.old
        1.0
        >>> states.s.new
        0.75
        """
        for method in self._FULL_ODE_METHODS:
            method(self)

    def get_point_states(self):
        """Load the states corresponding to the actual stage.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> states.s.old = 2.0
        >>> states.s.new = 2.0
        >>> model.numvars.idx_stage = 2
        >>> points = numpy.asarray(states.fastaccess._s_points)
        >>> points[:4] = 0.0, 0.0, 1.0, 0.0
        >>> model.get_point_states()
        >>> states.s.old
        2.0
        >>> states.s.new
        1.0
        """
        self._get_states(self.numvars.idx_stage, 'points')

    def _get_states(self, idx, type_):
        states = self.sequences.states
        for state in states:
            temp = getattr(states.fastaccess, '_%s_%s' % (state.name, type_))
            state.new = temp[idx]

    def set_point_states(self):
        """Save the states corresponding to the actual stage.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> states.s.old = 2.0
        >>> states.s.new = 1.0
        >>> model.numvars.idx_stage = 2
        >>> points = numpy.asarray(states.fastaccess._s_points)
        >>> points[:] = 0.
        >>> model.set_point_states()
        >>> from hydpy import round_
        >>> round_(points[:4])
        0.0, 0.0, 1.0, 0.0
        """
        self._set_states(self.numvars.idx_stage, 'points')

    def set_result_states(self):
        """Save the final states of the actual method.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> states.s.old = 2.0
        >>> states.s.new = 1.0
        >>> model.numvars.idx_method = 2
        >>> results = numpy.asarray(states.fastaccess._s_results)
        >>> results[:] = 0.0
        >>> model.set_result_states()
        >>> from hydpy import round_
        >>> round_(results[:4])
        0.0, 0.0, 1.0, 0.0
        """
        self._set_states(self.numvars.idx_method, 'results')

    def _set_states(self, idx, type_):
        states = self.sequences.states
        for state in states:
            temp = getattr(states.fastaccess, '_%s_%s' % (state.name, type_))
            temp[idx] = state.new

    def get_sum_fluxes(self):
        """Get the sum of the fluxes calculated so far.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> fluxes.q = 0.0
        >>> fluxes.fastaccess._q_sum = 1.0
        >>> model.get_sum_fluxes()
        >>> fluxes.q
        q(1.0)
        """
        fluxes = self.sequences.fluxes
        for flux in fluxes.numerics:
            flux(getattr(fluxes.fastaccess, '_%s_sum' % flux.name))

    def set_point_fluxes(self):
        """Save the fluxes corresponding to the actual stage.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> fluxes.q = 1.
        >>> model.numvars.idx_stage = 2
        >>> points = numpy.asarray(fluxes.fastaccess._q_points)
        >>> points[:] = 0.
        >>> model.set_point_fluxes()
        >>> from hydpy import round_
        >>> round_(points[:4])
        0.0, 0.0, 1.0, 0.0
        """
        self._set_fluxes(self.numvars.idx_stage, 'points')

    def set_result_fluxes(self):
        """Save the final fluxes of the actual method.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> fluxes.q = 1.
        >>> model.numvars.idx_method = 2
        >>> results = numpy.asarray(fluxes.fastaccess._q_results)
        >>> results[:] = 0.
        >>> model.set_result_fluxes()
        >>> from hydpy import round_
        >>> round_(results[:4])
        0.0, 0.0, 1.0, 0.0
        """
        self._set_fluxes(self.numvars.idx_method, 'results')

    def _set_fluxes(self, idx, type_):
        fluxes = self.sequences.fluxes
        for flux in fluxes.numerics:
            temp = getattr(fluxes.fastaccess, '_%s_%s' % (flux.name, type_))
            temp[idx] = flux

    def integrate_fluxes(self):
        """Perform a dot multiplication between the fluxes and the
        A coefficients associated with the different stages of the
        actual method.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> model.numvars.idx_method = 2
        >>> model.numvars.idx_stage = 1
        >>> model.numvars.dt = 0.5
        >>> points = numpy.asarray(fluxes.fastaccess._q_points)
        >>> points[:4] = 15., 2., -999., 0.
        >>> model.integrate_fluxes()
        >>> from hydpy import round_
        >>> from hydpy import pub
        >>> round_(numpy.asarray(model.numconsts.a_coefs)[1, 1, :2])
        0.375, 0.125
        >>> fluxes.q
        q(2.9375)
        """
        fluxes = self.sequences.fluxes
        for flux in fluxes.numerics:
            points = getattr(fluxes.fastaccess, '_%s_points' % flux.name)
            coefs = self.numconsts.a_coefs[self.numvars.idx_method-1,
                                           self.numvars.idx_stage,
                                           :self.numvars.idx_method]
            flux(self.numvars.dt *
                 numpy.dot(coefs, points[:self.numvars.idx_method]))

    def reset_sum_fluxes(self):
        """Set the sum of the fluxes calculated so far to zero.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> fluxes.fastaccess._q_sum = 5.
        >>> model.reset_sum_fluxes()
        >>> fluxes.fastaccess._q_sum
        0.0
        """
        fluxes = self.sequences.fluxes
        for flux in fluxes.numerics:
            if flux.NDIM == 0:
                setattr(fluxes.fastaccess, '_%s_sum' % flux.name, 0.)
            else:
                getattr(fluxes.fastaccess, '_%s_sum' % flux.name)[:] = 0.

    def addup_fluxes(self):
        """Add up the sum of the fluxes calculated so far.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> fluxes.fastaccess._q_sum = 1.0
        >>> fluxes.q(2.0)
        >>> model.addup_fluxes()
        >>> fluxes.fastaccess._q_sum
        3.0
        """
        fluxes = self.sequences.fluxes
        for flux in fluxes.numerics:
            sum_ = getattr(fluxes.fastaccess, '_%s_sum' % flux.name)
            sum_ += flux
            if flux.NDIM == 0:
                setattr(fluxes.fastaccess, '_%s_sum' % flux.name, sum_)

    def calculate_error(self):
        """Estimate the numerical error based on the fluxes calculated
        by the current and the last method.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> model.numvars.idx_method = 2
        >>> results = numpy.asarray(fluxes.fastaccess._q_results)
        >>> results[:4] = 0., 3., 4., 0.
        >>> model.calculate_error()
        >>> from hydpy import round_
        >>> round_(model.numvars.error)
        1.0
        """
        self.numvars.error = 0.
        fluxes = self.sequences.fluxes
        for flux in fluxes.numerics:
            results = getattr(fluxes.fastaccess, '_%s_results' % flux.name)
            diff = (results[self.numvars.idx_method] -
                    results[self.numvars.idx_method-1])
            self.numvars.error = max(self.numvars.error,
                                     numpy.max(numpy.abs(diff)))

    def extrapolate_error(self):
        """Estimate the numerical error to be expected when applying all
        methods available based on the results of the current and the
        last method.

        Note that this expolation strategy cannot be applied on the first
        method.  If the current method is the first one, `-999.9` is returned.

        >>> from hydpy.models.test_v1 import *
        >>> parameterstep()
        >>> model.numvars.error = 1e-2
        >>> model.numvars.last_error = 1e-1
        >>> model.numvars.idx_method = 10
        >>> model.extrapolate_error()
        >>> from hydpy import round_
        >>> round_(model.numvars.extrapolated_error)
        0.01
        >>> model.numvars.idx_method = 9
        >>> model.extrapolate_error()
        >>> round_(model.numvars.extrapolated_error)
        0.001
        """
        if self.numvars.idx_method > 2:
            self.numvars.extrapolated_error = modelutils.exp(
                modelutils.log(self.numvars.error) +
                (modelutils.log(self.numvars.error) -
                 modelutils.log(self.numvars.last_error)) *
                (self.numconsts.nmb_methods-self.numvars.idx_method))
        else:
            self.numvars.extrapolated_error = -999.9

autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/objecttools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
# -*- coding: utf-8 -*-
"""This module implements tools to help to standardize the functionality
of the different objects defined by the HydPy framework.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import copy
import inspect
import numbers
import sys
import textwrap
import wrapt
# ...from HydPy
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools


def dir_(self):
    """The prefered way for HydPy objects to respond to |dir|.

    Note the depencence on the `pub.options.dirverbose`.  If this option is
    set `True`, all attributes and methods of the given instance and its
    class (including those inherited from the parent classes) are returned:

    >>> from hydpy.pub import options
    >>> options.dirverbose = True
    >>> from hydpy.core.objecttools import dir_
    >>> class Test(object):
    ...     only_public_attribute =  None
    >>> print(len(dir_(Test())) > 1) # Long list, try it yourself...
    True

    If the option is set to `False`, only the `public` attributes and methods
    (which do need begin with `_`) are returned:

    >>> options.dirverbose = False
    >>> print(dir_(Test())) # Short list with one single entry...
    ['only_public_attribute']
    """
    names = set()
    for thing in list(inspect.getmro(type(self))) + [self]:
        for name in vars(thing).keys():
            if pub.options.dirverbose or not name.startswith('_'):
                names.add(name)
    if names:
        names = list(names)
    else:
        names = [' ']
    return names


def classname(self):
    """Return the class name of the given instance object or class.

    >>> from hydpy.core.objecttools import classname
    >>> from hydpy.pub import options
    >>> print(classname(float))
    float
    >>> print(classname(options))
    Options
    """
    if not inspect.isclass(self):
        self = type(self)
    return str(self).split("'")[1].split('.')[-1]


def instancename(self):
    """Return the class name of the given instance object or class in lower
    case letters.

    >>> from hydpy.core.objecttools import instancename
    >>> from hydpy.pub import options
    >>> print(instancename(options))
    options
    """
    return classname(self).lower()


def value_of_type(value):
    """Returns a string containing both the informal string and the type
    of the given value.

    This function is intended to simplifying writing HydPy exceptions,
    which frequently contain the following phrase:

    >>> from hydpy.core.objecttools import value_of_type
    >>> value_of_type(999)
    'value `999` of type `int`'
    """
    return 'value `%s` of type `%s`' % (value, classname(value))


def name(self):
    """Name of the class of the given instance in lower case letters.

    This function is thought to be implemented as a property.  Otherwise
    it would violate the principle not to access or manipulate private
    attributes ("_name"):

    >>> from hydpy.core.objecttools import name
    >>> class Test(object):
    ...     name = property(name)
    >>> test1 = Test()
    >>> test1.name
    'test'
    >>> test1._name
    'test'

    The private attribute is added for performance reasons only.  Note that
    it is a class attribute:

    >>> test2 = Test()
    >>> test2._name
    'test'
    """
    try:
        return type(self).__dict__['_name']
    except KeyError:
        type(self)._name = instancename(self)
        return type(self).__dict__['_name']


def modulename(self):
    """Return the module name of the given instance object.

    >>> from hydpy.core.objecttools import modulename
    >>> from hydpy.pub import options
    >>> print(modulename(options))
    optiontools
    """
    return self.__module__.split('.')[-1]


def _search_device(self):
    while True:
        device = getattr(self, 'element', getattr(self, 'node', None))
        if device is not None:
            return device
        for test in ('model', 'seqs', 'subseqs', 'pars', 'subpars'):
            master = getattr(self, test, None)
            if master is not None:
                self = master
                break
        else:
            return None


def devicename(self):
    """Try to return the name of the (indirect) master |Node| or
    |Element| instance, if not possible return `?`.

    >>> from hydpy.core.modeltools import Model
    >>> model = Model()
    >>> from hydpy.core.objecttools import devicename
    >>> devicename(model)
    '?'

    >>> from hydpy import Element
    >>> e1 = Element('e1')
    >>> e1.connect(model)
    >>> devicename(model)
    'e1'
    """
    device = _search_device(self)
    return getattr(device, 'name', '?')


def _devicephrase(self, objname=None):
    device = _search_device(self)
    if device and objname:
        return ' of %s `%s` ' % (objname, device.name)
    elif objname:
        return ' of %s `?` ' % objname
    elif device:
        return (' of %s `%s` '
                % (instancename(device), device.name))
    else:
        return ' '


def elementphrase(self):
    """Return the phrase used in exception messages to indicate
    which |Element| is affected.

    >>> from hydpy.core.modeltools import Model
    >>> model = Model()
    >>> from hydpy.core.objecttools import elementphrase
    >>> elementphrase(model)
    ' of element `?` '

    >>> from hydpy import Element
    >>> e1 = Element('e1')
    >>> e1.connect(model)
    >>> elementphrase(model)
    ' of element `e1` '
    """
    return _devicephrase(self, 'element')


def nodephrase(self):
    """Return the phrase used in exception messages to indicate
    which |Node| is affected.

    >>> from hydpy.core.sequencetools import Sequences
    >>> sequences = Sequences()
    >>> from hydpy.core.objecttools import nodephrase
    >>> nodephrase(sequences)
    ' of node `?` '

    >>> from hydpy import Node
    >>> n1 = Node('n1')
    >>> nodephrase(n1.sequences.sim)
    ' of node `n1` '
    """
    return _devicephrase(self, 'node')


def devicephrase(self):
    """Try to return the phrase used in exception messages to
    indicate which |Element| or which |Node| is affected.
    If not possible return a single empty space.

    >>> from hydpy.core.modeltools import Model
    >>> model = Model()
    >>> from hydpy.core.objecttools import devicephrase
    >>> devicephrase(model)
    ' '

    >>> from hydpy import Element
    >>> e1 = Element('e1')
    >>> e1.connect(model)
    >>> devicephrase(model)
    ' of element `e1` '

    >>> from hydpy import Node
    >>> n1 = Node('n1')
    >>> devicephrase(n1.sequences.sim)
    ' of node `n1` '
    """
    return _devicephrase(self)


def valid_variable_identifier(name):
    """Raises an |ValueError| if the given name is not a valid Python
    identifier.

    For example, the string `test_1` (with underscore) is valid...

    >>> from hydpy.core.objecttools import valid_variable_identifier
    >>> valid_variable_identifier('test_1')

    ...but the string `test 1` (with white space) is not:

    >>> valid_variable_identifier('test 1')
    Traceback (most recent call last):
    ...
    ValueError: The given name string `test 1` does not define a valid \
variable identifier.  Valid identifiers do not contain characters like \
`-` or empty spaces, do not start with numbers, cannot be mistaken with \
Python built-ins like `for`...)

    Also, names of Python built ins are not allowed:

    >>> valid_variable_identifier('while')
    Traceback (most recent call last):
    ...
    ValueError: The given name string `while` does not define...
    """
    string = str(name)
    try:
        exec('%s = None' % string)
        if name in dir(__builtins__):
            raise SyntaxError()
    except SyntaxError:
        raise ValueError(
            'The given name string `%s` does not define a valid variable '
            'identifier.  Valid identifiers do not contain characters like '
            '`-` or empty spaces, do not start with numbers, cannot be '
            'mistaken with Python built-ins like `for`...)' % name)


def augment_excmessage(prefix=None, suffix=None):
    """Augment an exception message with additional information while keeping
    the original traceback.

    You can prefix and/or suffix text.  If you prefix something (which happens
    much more often in the HydPy framework), the sub-clause ', the following
    error occured:' is automatically included:

    >>> from hydpy.core import objecttools
    >>> import textwrap
    >>> try:
    ...     1 + '1'
    ... except TypeError:
    ...     try:
    ...         prefix = 'While showing how prefixing works'
    ...         suffix = '(This is a final remark.)'
    ...         objecttools.augment_excmessage(prefix, suffix)
    ...     except TypeError as exc:
    ...         for line in textwrap.wrap(exc.args[0], width=76):
    ...             print(line)
    While showing how prefixing works, the following error occured: unsupported
    operand type(s) for +: 'int' and 'str' (This is a final remark.)

    Note that the ancillary purpose of function |augment_excmessage| is
    to make re-raising exceptions compatible with both Python 2 and 3.
    """
    exception, message, traceback_ = sys.exc_info()
    if prefix is not None:
        message = ('%s, the following error occured: %s'
                   % (prefix, message))
    if suffix is not None:
        message = ' '.join((message, suffix))
    if pub.pyversion < 3:
        exec('raise exception, message, traceback_')
    else:
        raise exception(message).with_traceback(traceback_)


def excmessage_decorator(description):
    """Wrap a function with |augment_excmessage|.

    Function |excmessage_decorator| is a means to apply function
    |augment_excmessage| more efficiently.  Suppose you would apply
    function |augment_excmessage| in a function that adds and returns
    to numbers:

    >>> from  hydpy.core import objecttools
    >>> def add(x, y):
    ...     try:
    ...         return x + y
    ...     except BaseException:
    ...         objecttools.augment_excmessage(
    ...             'While trying to add `x` and `y`')

    This works as excepted...

    >>> add(1, 2)
    3
    >>> add(1, [])
    Traceback (most recent call last):
    ...
    TypeError: While trying to add `x` and `y`, the following error \
occured: unsupported operand type(s) for +: 'int' and 'list'

    ...but can be achieved with much less code using |excmessage_decorator|:

    >>> @objecttools.excmessage_decorator(
    ...     'add `x` and `y`')
    ... def add(x, y):
    ...     return x+y

    >>> add(1, 2)
    3

    >>> add(1, [])
    Traceback (most recent call last):
    ...
    TypeError: While trying to add `x` and `y`, the following error \
occured: unsupported operand type(s) for +: 'int' and 'list'

    Additionally, exception messages related to wrong function calls
    are now also augmented (the end of the message depends on the
    employed Python version):

    >>> add(1)
    Traceback (most recent call last):
    ...
    TypeError: While trying to add `x` and `y`, the following error \
occured: add() ...

    It is made sure that no information of the decorated function is lost:

    >>> add.__name__
    'add'
    """
    @wrapt.decorator
    def wrapper(wrapped, instance, args, kwargs):
        try:
            return wrapped(*args, **kwargs)
        except BaseException:
            augment_excmessage('While trying to %s' % description)
    return wrapper


class ResetAttrFuncs(object):
    """Reset all attribute related methods of the given class temporarily.

    The "related methods" are defined in class attribute
    |ResetAttrFuncs.funcnames|.

    There are (at least) two use cases for  class |ResetAttrFuncs|,
    initialization and copying, which are described below.

    In HydPy, some classes define a `__setattr__` method which raises
    exceptions when one tries to set "improper" instance attributes.
    The problem is, that such customized `setattr` methods often prevent
    from defining instance attributes within `__init__` methods in the
    usual manner.  Working on instance dictionaries instead can confuse
    some automatic tools (e.g. pylint).  Class |ResetAttrFuncs|
    implements a trick to circumvent this problem.

    To show how |ResetAttrFuncs| works, we first define a class
    with a `__setattr__` method that does not allow to set any attribute:

    >>> class Test(object):
    ...     def __setattr__(self, name, value):
    ...         raise AttributeError
    >>> test = Test()
    >>> test.var1 = 1
    Traceback (most recent call last):
    ...
    AttributeError

    Assigning this class to |ResetAttrFuncs| allows for setting
    attributes to all its instances inside a `with` block in the
    usual manner:

    >>> from hydpy.core.objecttools import ResetAttrFuncs
    >>> with ResetAttrFuncs(test):
    ...     test.var1 = 1
    >>> test.var1
    1

    After the end of the `with` block, the custom `__setattr__` method
    of the test class works again and prevents from setting attributes:

    >>> test.var2 = 2
    Traceback (most recent call last):
    ...
    AttributeError

    The second use case is related to method `__getattr__` and copying.
    The following test class stores its attributes (for whatever reasons)
    in a special dictionary called "dic" (note that how
    |ResetAttrFuncs| is used in the `__init__` method):

    >>> class Test(object):
    ...     def __init__(self):
    ...         with ResetAttrFuncs(self):
    ...             self.dic = {}
    ...     def __setattr__(self, name, value):
    ...         self.dic[name] = value
    ...     def __getattr__(self, name):
    ...         try:
    ...             return self.dic[name]
    ...         except KeyError:
    ...             raise AttributeError

    Principally, this simple implementation does its job but its
    instances are not easily copyable under all Python versions:

    >>> test = Test()
    >>> test.var1 = 1
    >>> test.var1
    1
    >>> import copy
    >>> copy.deepcopy(test)   # doctest: +SKIP
    Traceback (most recent call last):
    ...
    RecursionError: maximum recursion depth exceeded ...

    |ResetAttrFuncs| can be used to implement specialized
    `__copy__` and `__deepcopy__` methods, which rely on the temporary
    disabling of `__getattr__`.  For simple cases, one can import the
    predefined functions |copy_| and |deepcopy_|:

    >>> from hydpy.core.objecttools import copy_, deepcopy_
    >>> Test.__copy__ = copy_
    >>> test2 = copy.copy(test)
    >>> test2.var1
    1
    >>> Test.__deepcopy__ = deepcopy_
    >>> test3 = copy.deepcopy(test)
    >>> test3.var1
    1

    Note that an infinite recursion is avoided by also disabling methods
    `__copy__` and `__deepcopy__` themselves.

    """
    __slots__ = ('cls', 'name2func')
    funcnames = ('__getattr__', '__setattr__', '__delattr__',
                 '__copy__', '__deepcopy__')

    def __init__(self, obj):
        self.cls = type(obj)
        self.name2func = {}
        for name in self.funcnames:
            if hasattr(self.cls, name):
                self.name2func[name] = self.cls.__dict__.get(name)

    def __enter__(self):
        for name in self.name2func.keys():
            if name in ('__setattr__', '__delattr__'):
                setattr(self.cls, name, getattr(object, name))
            elif name == '__getattr__':
                setattr(self.cls, name, object.__getattribute__)
            else:
                setattr(self.cls, name, None)
        return self

    def __exit__(self, exception, message, traceback_):
        for name, func in self.name2func.items():
            if func:
                setattr(self.cls, name, func)
            else:
                delattr(self.cls, name)


def copy_(self):
    """Copy function for classes with modified attribute functions.

    See the documentation on class |ResetAttrFuncs| for further information.
    """
    with ResetAttrFuncs(self):
        return copy.copy(self)


def deepcopy_(self, memo):
    """Deepcopy function for classes with modified attribute functions.

    See the documentation on class |ResetAttrFuncs| for further information.
    """
    with ResetAttrFuncs(self):
        return copy.deepcopy(self, memo)


class _PreserveStrings(object):
    """Helper class for |_Repr_|."""

    def __init__(self, preserve_strings):
        self.new_value = preserve_strings
        self.old_value = repr_._preserve_strings

    def __enter__(self):
        repr_._preserve_strings = self.new_value
        return None

    def __exit__(self, type_, value, traceback):
        repr_._preserve_strings = self.old_value


class _Repr_(object):
    """Modifies |repr| for strings and floats, mainly for supporting
    clean float representations that are compatible with |doctest|.

    When value is a string, it is returned without any modification:

    >>> from hydpy.core.objecttools import repr_
    >>> print('test')
    test
    >>> print(repr('test'))
    'test'
    >>> print(repr_('test'))
    test

    You can change this behaviour of function object |repr|,
    when necessary:

    >>> with repr_.preserve_strings(True):
    ...     print(repr_('test'))
    "test"

    Behind the with block, |repr_| works as before
    (even in case of an error):

    >>> print(repr_('test'))
    test

    When value is a float, the result depends on how the option
    |Options.reprdigits| is set. If it is to -999, |repr| defines the
    number of digits in the usual, system dependent manner:

    >>> from hydpy.pub import options
    >>> options.reprdigits = -999
    >>> repr(1./3.) == repr_(1./3.)
    True

    Through setting |Options.reprdigits| to a positive integer value,
    one defines the maximum number of decimal places, which allows for
    doctesting across different systems and Python versions:

    >>> options.reprdigits = 6
    >>> repr_(1./3.)
    '0.333333'
    >>> repr_(2./3.)
    '0.666667'
    >>> repr_(1./2.)
    '0.5'

    Changing the number of decimal places can be done via a with block:

    >>> with options.reprdigits(3):
    ...     print(repr_(1./3.))
    0.333

    Such a change is only temporary (even in case of an error):
    >>> repr_(1./3.)
    '0.333333'

    |repr| can also be applied on numpy's float types:

    >>> import numpy
    >>> repr_(numpy.float(1./3.))
    '0.333333'
    >>> repr_(numpy.float64(1./3.))
    '0.333333'
    >>> repr_(numpy.float32(1./3.))
    '0.333333'
    >>> repr_(numpy.float16(1./3.))
    '0.333252'

    Note that the deviation from the `true` result in the last example is due
    to the low precision of |float16|.

    On all types not mentioned above, the usual |repr| function is
    applied, e.g.:

    >>> repr([1, 2, 3])
    '[1, 2, 3]'
    >>> repr_([1, 2, 3])
    '[1, 2, 3]'
    """

    def __init__(self):
        self._preserve_strings = False

    def __call__(self, value):
        decimals = pub.options.reprdigits
        if isinstance(value, str):
            if self._preserve_strings:
                return '"%s"' % value
            else:
                return value
        if ((decimals > -1) and
                isinstance(value, numbers.Real) and
                (not isinstance(value, numbers.Integral))):
            string = '{0:.{1}f}'.format(value, decimals)
            string = string.rstrip('0')
            if string.endswith('.'):
                string += '0'
            return string
        else:
            return repr(value)

    def preserve_strings(self, preserve_strings):
        """Change the `preserve_string` option inside a with block."""
        return _PreserveStrings(preserve_strings)


repr_ = _Repr_()


def repr_values(values):
    """Return comma separated representations of the given values using
    function |repr|.

    >>> from hydpy.core.objecttools import repr_values
    >>> repr_values([1./1., 1./2., 1./3.])
    '1.0, 0.5, 0.333333'

    Note that the returned string is not wrapped.
    """
    return '%s' % ', '.join(repr_(value) for value in values)


def print_values(values, width=70):
    """Print the given values in multiple lines with a certain maximum width.

    By default, each line contains at most 70 characters:

    >>> from hydpy import print_values
    >>> print_values(range(21))
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
    20

    You can change this default behaviour by passing an alternative
    number of characters:

    >>> print_values(range(21), width=30)
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
    10, 11, 12, 13, 14, 15, 16,
    17, 18, 19, 20
    """
    for line in textwrap.wrap(repr_values(values), width=width):
        print(line)


def repr_tuple(values):
    """Return a tuple representation of the given values using function
    |repr|.

    >>> from hydpy.core.objecttools import repr_tuple
    >>> repr_tuple([1./1., 1./2., 1./3.])
    '(1.0, 0.5, 0.333333)'

    Note that the returned string is not wrapped.

    In the special case of an iterable with only one entry, the returned
    string is still a valid tuple:

    >>> repr_tuple([1.])
    '(1.0,)'
    """
    if len(values) == 1:
        return '(%s,)' % repr_values(values)
    else:
        return '(%s)' % repr_values(values)


def repr_list(values):
    """Return a list representation of the given values using function
    |repr|.

    >>> from hydpy.core.objecttools import repr_list
    >>> repr_list([1./1., 1./2., 1./3.])
    '[1.0, 0.5, 0.333333]'

    Note that the returned string is not wrapped.
    """
    return '[%s]' % repr_values(values)


def assignrepr_value(value, prefix, width=None):
    """Return a prefixed string representation of the given value using
    function |repr|.

    Note that the argument has no effect. It is thought for increasing
    usage compatibility with functions like |assignrepr_list| only.

    >>> from hydpy.core.objecttools import assignrepr_value
    >>> print(assignrepr_value(1./3., 'test = '))
    test = 0.333333
    """
    return prefix + repr_(value)


def assignrepr_values(values, prefix, width=None, _fakeend=0):
    """Return a prefixed, wrapped and properly aligned string representation
    of the given values using function |repr|.

    >>> from hydpy.core.objecttools import assignrepr_values
    >>> print(assignrepr_values(range(1, 13), 'test(', 20) + ')')
    test(1, 2, 3, 4, 5,
         6, 7, 8, 9, 10,
         11, 12)

    If no width is given, no wrapping is performed:

    >>> print(assignrepr_values(range(1, 13), 'test(') + ')')
    test(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)


    To circumvent defining too long string representations, make use of the
    ellipsis option:

    >>> from hydpy.pub import options
    >>> with options.ellipsis(1):
    ...     print(assignrepr_values(range(1, 13), 'test(', 20) + ')')
    test(1, ...,12)

    >>> with options.ellipsis(5):
    ...     print(assignrepr_values(range(1, 13), 'test(', 20) + ')')
    test(1, 2, 3, 4, 5,
         ...,8, 9, 10,
         11, 12)

    >>> with options.ellipsis(6):
    ...     print(assignrepr_values(range(1, 13), 'test(', 20) + ')')
    test(1, 2, 3, 4, 5,
         6, 7, 8, 9, 10,
         11, 12)
    """
    ellipsis = pub.options.ellipsis
    if (ellipsis > 0) and (len(values) > 2*ellipsis):
        string = (repr_values(values[:ellipsis]) +
                  ', ...,' +
                  repr_values(values[-ellipsis:]))
    else:
        string = repr_values(values)
    blanks = ' '*len(prefix)
    if width is None:
        wrapped = [string]
        _fakeend = 0
    else:
        width -= len(prefix)
        wrapped = textwrap.wrap(string+'_'*_fakeend, width)
    if not wrapped:
        wrapped = ['']
    lines = []
    for (idx, line) in enumerate(wrapped):
        if idx == 0:
            lines.append('%s%s' % (prefix, line))
        else:
            lines.append('%s%s' % (blanks, line))
    string = '\n'.join(lines)
    return string[:len(string)-_fakeend]


class _AlwaysBracketed(object):
    """Helper class for |_AssignReprBracketed|."""

    def __init__(self, value):
        self.new_value = value
        self.old_value = _AssignReprBracketed._always_bracketed

    def __enter__(self):
        _AssignReprBracketed._always_bracketed = self.new_value

    def __exit__(self, type_, value, traceback):
        _AssignReprBracketed._always_bracketed = self.old_value


class _AssignReprBracketed(object):
    """"Double Singleton class", see the documentation on
    |assignrepr_tuple| and |assignrepr_list|."""

    _always_bracketed = True

    def __init__(self, brackets):
        self._brackets = brackets

    def __call__(self, values, prefix, width=None):
        if (len(values) == 1) and not self._always_bracketed:
            return assignrepr_value(values[0], prefix)
        elif len(values):
            string = assignrepr_values(
                values, prefix+self._brackets[0], width, 1) + self._brackets[1]
            if (len(values) == 1) and (self._brackets[1] == ')'):
                return string[:-1] + ',)'
            else:
                return string
        else:
            return prefix + self._brackets

    def always_bracketed(self, always_bracketed):
        """Change the `always_bracketed` option inside a with block."""
        return _AlwaysBracketed(always_bracketed)


assignrepr_tuple = _AssignReprBracketed('()')
"""Return a prefixed, wrapped and properly aligned tuple string
representation of the given values using function |repr|.

>>> from hydpy.core.objecttools import assignrepr_tuple
>>> print(assignrepr_tuple(range(10), 'test = ', 22))
test = (0, 1, 2, 3, 4,
        5, 6, 7, 8, 9)

If no width is given, no wrapping is performed:

>>> print(assignrepr_tuple(range(10), 'test = '))
test = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

Functions |assignrepr_tuple| works also on empty iterables and
those which possess only one entry:

>>> print(assignrepr_tuple([], 'test = '))
test = ()
>>> print(assignrepr_tuple([10], 'test = '))
test = (10,)

Optionally, bracketing single values can be prevented:

>>> with assignrepr_tuple.always_bracketed(False):
...     print(assignrepr_tuple([], 'test = '))
...     print(assignrepr_tuple([10], 'test = '))
...     print(assignrepr_tuple([10, 10], 'test = '))
test = ()
test = 10
test = (10, 10)

Behind the with block, |assignrepr_tuple| works as before
(even in case of an error):

>>> print(assignrepr_tuple([10], 'test = '))
test = (10,)
"""


assignrepr_list = _AssignReprBracketed('[]')
"""Return a prefixed, wrapped and properly aligned list string
representation of the given values using function |repr|.

>>> from hydpy.core.objecttools import assignrepr_list
>>> print(assignrepr_list(range(10), 'test = ', 22))
test = [0, 1, 2, 3, 4,
        5, 6, 7, 8, 9]

If no width is given, no wrapping is performed:

>>> print(assignrepr_list(range(10), 'test = '))
test = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Functions |assignrepr_list| works also on empty iterables:

>>> print(assignrepr_list((), 'test = '))
test = []

Optionally, bracketing single values can be prevented:

>>> with assignrepr_list.always_bracketed(False):
...     print(assignrepr_list([], 'test = '))
...     print(assignrepr_list([10], 'test = '))
...     print(assignrepr_list([10, 10], 'test = '))
test = []
test = 10
test = [10, 10]

Behind the with block, |assignrepr_list| works as before
(even in case of an error):

>>> print(assignrepr_list([10], 'test = '))
test = [10,]
"""


def assignrepr_values2(values, prefix):
    """Return a prefixed and properly aligned string representation
    of the given 2-dimensional value matrix using function |repr|.

    >>> from hydpy.core.objecttools import assignrepr_values2
    >>> import numpy
    >>> print(assignrepr_values2(numpy.eye(3), 'test(') + ')')
    test(1.0, 0.0, 0.0,
         0.0, 1.0, 0.0,
         0.0, 0.0, 1.0)

    Functions |assignrepr_values2| works also on empty iterables:

    >>> print(assignrepr_values2([[]], 'test(') + ')')
    test()
    """
    lines = []
    blanks = ' '*len(prefix)
    for (idx, subvalues) in enumerate(values):
        if idx == 0:
            lines.append('%s%s,' % (prefix, repr_values(subvalues)))
        else:
            lines.append('%s%s,' % (blanks, repr_values(subvalues)))
    lines[-1] = lines[-1][:-1]
    return '\n'.join(lines)


def _assignrepr_bracketed2(assignrepr_bracketed1, values, prefix, width=None):
    """Return a prefixed, wrapped and properly aligned bracketed string
    representation of the given 2-dimensional value matrix using function
    |repr|."""
    prefix += assignrepr_bracketed1._brackets[0]
    lines = []
    blanks = ' '*len(prefix)
    for (idx, subvalues) in enumerate(values):
        if idx == 0:
            lines.append(assignrepr_bracketed1(subvalues, prefix, width))
        else:
            lines.append(assignrepr_bracketed1(subvalues, blanks, width))
        if (len(subvalues) == 1) and (lines[-1] == ')'):
            lines[-1] = lines[-1].replace(')', ',)')
        lines[-1] += ','
    lines[-1] = lines[-1][:-1] + assignrepr_bracketed1._brackets[1]
    return '\n'.join(lines)


def assignrepr_tuple2(values, prefix, width=None):
    """Return a prefixed, wrapped and properly aligned tuple string
    representation of the given 2-dimensional value matrix using function
    |repr|.

    >>> from hydpy.core.objecttools import assignrepr_tuple2
    >>> import numpy
    >>> print(assignrepr_tuple2(numpy.eye(3), 'test = ', 18))
    test = ((1.0, 0.0,
             0.0),
            (0.0, 1.0,
             0.0),
            (0.0, 0.0,
             1.0))

    If no width is given, no wrapping is performed:

    >>> print(assignrepr_tuple2(numpy.eye(3), 'test = '))
    test = ((1.0, 0.0, 0.0),
            (0.0, 1.0, 0.0),
            (0.0, 0.0, 1.0))

    Functions |assignrepr_tuple2| works also on empty iterables and
    those which possess only one entry:

    >>> print(assignrepr_tuple2([[]], 'test = '))
    test = (())
    >>> print(assignrepr_tuple2([[], [1]], 'test = '))
    test = ((),
            (1,))
    """
    return _assignrepr_bracketed2(assignrepr_tuple, values, prefix, width)


def assignrepr_list2(values, prefix, width=None):
    """Return a prefixed, wrapped and properly aligned list string
    representation of the given 2-dimensional value matrix using function
    |repr|.

    >>> from hydpy.core.objecttools import assignrepr_list2
    >>> import numpy
    >>> print(assignrepr_list2(numpy.eye(3), 'test = ', 18))
    test = [[1.0, 0.0,
             0.0],
            [0.0, 1.0,
             0.0],
            [0.0, 0.0,
             1.0]]

    If no width is given, no wrapping is performed:

    >>> print(assignrepr_list2(numpy.eye(3), 'test = '))
    test = [[1.0, 0.0, 0.0],
            [0.0, 1.0, 0.0],
            [0.0, 0.0, 1.0]]

    Functions |assignrepr_list2| works also on empty iterables:

    >>> print(assignrepr_list2([[]], 'test = '))
    test = [[]]
    >>> print(assignrepr_list2([[], [1]], 'test = '))
    test = [[],
            [1]]
    """
    return _assignrepr_bracketed2(assignrepr_list, values, prefix, width)


def _assignrepr_bracketed3(assignrepr_bracketed1, values, prefix, width=None):
    """Return a prefixed, wrapped and properly aligned bracketed string
    representation of the given 3-dimensional value matrix using function
    |repr|."""
    prefix += assignrepr_bracketed1._brackets[0]
    lines = []
    blanks = ' '*len(prefix)
    for (idx, subvalues) in enumerate(values):
        if idx == 0:
            lines.append(_assignrepr_bracketed2(
                            assignrepr_bracketed1, subvalues, prefix, width))
        else:
            lines.append(_assignrepr_bracketed2(
                            assignrepr_bracketed1, subvalues, blanks, width))
        if (len(subvalues) <= 1) and (lines[-1][-1] == ')'):
            lines[-1] = lines[-1][:-1] + ',)'
        lines[-1] += ','
    lines[-1] = lines[-1][:-1] + assignrepr_bracketed1._brackets[1]
    if (len(values) <= 1) and (lines[-1][-1] == ')'):
        lines[-1] = lines[-1][:-1] + ',)'
    return '\n'.join(lines)


def assignrepr_tuple3(values, prefix, width=None):
    """Return a prefixed, wrapped and properly aligned tuple string
    representation of the given 3-dimensional value matrix using function
    |repr|.

    >>> from hydpy.core.objecttools import assignrepr_tuple3
    >>> import numpy
    >>> values = [numpy.eye(3), numpy.ones((3, 3))]
    >>> print(assignrepr_tuple3(values, 'test = ', 18))
    test = (((1.0,
              0.0,
              0.0),
             (0.0,
              1.0,
              0.0),
             (0.0,
              0.0,
              1.0)),
            ((1.0,
              1.0,
              1.0),
             (1.0,
              1.0,
              1.0),
             (1.0,
              1.0,
              1.0)))

    If no width is given, no wrapping is performed:

    >>> print(assignrepr_tuple3(values, 'test = '))
    test = (((1.0, 0.0, 0.0),
             (0.0, 1.0, 0.0),
             (0.0, 0.0, 1.0)),
            ((1.0, 1.0, 1.0),
             (1.0, 1.0, 1.0),
             (1.0, 1.0, 1.0)))

    Functions |assignrepr_tuple3| works also on empty iterables and
    those which possess only one entry:

    >>> print(assignrepr_tuple3([[[]]], 'test = '))
    test = (((),),)
    >>> print(assignrepr_tuple3([[[], [1]]], 'test = '))
    test = (((),
             (1,)),)
    """
    return _assignrepr_bracketed3(assignrepr_tuple, values, prefix, width)


def assignrepr_list3(values, prefix, width=None):
    """Return a prefixed, wrapped and properly aligned list string
    representation of the given 3-dimensional value matrix using function
    |repr|.

    >>> from hydpy.core.objecttools import assignrepr_list3
    >>> import numpy
    >>> values = [numpy.eye(3), numpy.ones((3, 3))]
    >>> print(assignrepr_list3(values, 'test = ', 18))
    test = [[[1.0,
              0.0,
              0.0],
             [0.0,
              1.0,
              0.0],
             [0.0,
              0.0,
              1.0]],
            [[1.0,
              1.0,
              1.0],
             [1.0,
              1.0,
              1.0],
             [1.0,
              1.0,
              1.0]]]

    If no width is given, no wrapping is performed:

    >>> print(assignrepr_list3(values, 'test = '))
    test = [[[1.0, 0.0, 0.0],
             [0.0, 1.0, 0.0],
             [0.0, 0.0, 1.0]],
            [[1.0, 1.0, 1.0],
             [1.0, 1.0, 1.0],
             [1.0, 1.0, 1.0]]]

    Functions |assignrepr_list3| works also on empty iterables and
    those which possess only one entry:

    >>> print(assignrepr_list3([[[]]], 'test = '))
    test = [[[]]]
    >>> print(assignrepr_list3([[[], [1]]], 'test = '))
    test = [[[],
             [1]]]
    """
    return _assignrepr_bracketed3(assignrepr_list, values, prefix, width)


def round_(values, decimals=None, width=0,
           lfill=None, rfill=None, **kwargs):
    """Prints values with a maximum number of digits in doctests.

    See the documentation on function |repr| for more details.  And
    note thate the option keyword arguments are passed to the print function.

    Usually one would apply function |round_| on a single or a vector
    of numbers:

    >>> from hydpy import round_
    >>> round_(1./3., decimals=6)
    0.333333
    >>> round_((1./2., 1./3., 1./4.), decimals=4)
    0.5, 0.3333, 0.25

    Additionally, one can supply a `width` and a `rfill` argument:
    >>> round_(1.0, width=6, rfill='0')
    1.0000

    Alternatively, one can use the `lfill` arguments, which
    might e.g. be usefull for aligning different strings:

    >>> round_('test', width=6, lfill='_')
    __test

    Using both the `lfill` and the `rfill` argument raises an error:

    >>> round_(1.0, lfill='_', rfill='0')
    Traceback (most recent call last):
    ...
    ValueError: For function `round_` values are passed for both \
arguments `lfill` and `rfill`.  This is not allowed.
    """
    if decimals is None:
        decimals = pub.options.reprdigits
    with pub.options.reprdigits(decimals):
        if isinstance(values, abctools.IterableNonStringABC):
            string = repr_values(values)
        else:
            string = repr_(values)
        if (lfill is not None) and (rfill is not None):
            raise ValueError(
                'For function `round_` values are passed for both arguments '
                '`lfill` and `rfill`.  This is not allowed.')
        if (lfill is not None) or (rfill is not None):
            width = max(width, len(string))
            if lfill is not None:
                string = string.rjust(width, lfill)
            else:
                string = string.ljust(width, rfill)
        print(string, **kwargs)


def extract(values, types, skip=False):
    """Return a generator that extracts certain objects from `values`.

    This function is thought for supporting the definition of functions
    with arguments, that can be objects of of contain types or that can
    be iterables containing these objects.

    The following examples show that function |extract|
    basically implements a type specific flattening mechanism:

    >>> from hydpy.core.objecttools import extract
    >>> tuple(extract('str1', (str, int)))
    ('str1',)
    >>> tuple(extract(['str1', 'str2'], (str, int)))
    ('str1', 'str2')
    >>> tuple(extract((['str1', 'str2'], [1,]), (str, int)))
    ('str1', 'str2', 1)

    If an object is neither iterable nor of the required type, the
    following exception is raised:

    >>> tuple(extract((['str1', 'str2'], [None, 1]), (str, int)))
    Traceback (most recent call last):
    ...
    TypeError: The given value `'None'` is neither iterable nor \
an instance of the following classes: str and int.

    Optionally, |None| values can be skipped:

    >>> tuple(extract(None, (str, int), True))
    ()
    >>> tuple(extract((['str1', 'str2'], [None, 1]), (str, int), True))
    ('str1', 'str2', 1)
    """
    if isinstance(values, types):
        yield values
    elif skip and (values is None):
        return
    else:
        try:
            for value in values:
                for subvalue in extract(value, types, skip):
                    yield subvalue
        except TypeError as exc:
            if exc.args[0].startswith('The given value'):
                raise exc
            else:
                raise TypeError(
                    'The given value `{0!r}` is neither iterable nor an '
                    'instance of the following classes: {1}.'
                    .format(repr(values),
                            enumeration(types, converter=instancename)))


def enumeration(values, converter=str, default=''):
    """Return an enumeration string based on the given values.

    The following four examples show the standard output of function
    |enumeration|:

    >>> from hydpy.core.objecttools import enumeration
    >>> enumeration(('text', 3, []))
    'text, 3, and []'
    >>> enumeration(('text', 3))
    'text and 3'
    >>> enumeration(('text',))
    'text'
    >>> enumeration(())
    ''

    All given objects are converted to strings by function |str|, as shown
    by the first two examples.  This behaviour can be changed by another
    function expecting a single argument and returning a string:

    >>> from hydpy.core.objecttools import classname
    >>> enumeration(('text', 3, []), converter=classname)
    'str, int, and list'

    Furthermore, you can define a default string that is returned
    in case an empty iterable is given:

    >>> enumeration((), default='nothing')
    'nothing'
    """
    values = tuple(converter(value) for value in values)
    if len(values) == 0:
        return default
    elif len(values) == 1:
        return values[0]
    elif len(values) == 2:
        return ' and '.join(values)
    else:
        return ', and '.join((', '.join(values[:-1]), values[-1]))


class FastAccess(object):
    """Used as a surrogate for typed Cython classes when working in
    pure Python mode."""


class HydPyDeprecationWarning(DeprecationWarning):
    pass


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/optiontools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
# -*- coding: utf-8 -*-
"""This module implements classes that help to manage global HydPy options."""

# import...
# ...from the Python standard library
from __future__ import division, print_function
import inspect
# ...from HydPy
from hydpy.core import autodoctools


class _Context(object):

    def __init__(self, option):
        self.option = option
        self.old_value = option.value

    def __enter__(self):
        return self

    def __call__(self, value, optional=False):
        if (self.option.value == self.option.nothing) or not optional:
            self.option.value = self.option.type_(value)
        return self

    def __exit__(self, type_, value, traceback):
        self.option.value = self.old_value


class _IntContext(_Context, int):

    def __new__(cls, option):
        return int.__new__(cls, option.value)


class _FloatContext(_Context, float):

    def __new__(cls, option):
        return float.__new__(cls, option.value)


class _StrContext(_Context, str):

    def __new__(cls, option):
        return str.__new__(cls, option.value)


class _Option(object):

    TYPE2CONTEXT = {int: _IntContext,
                    bool: _IntContext,
                    float: _FloatContext,
                    str: _StrContext}

    def __init__(self, default, nothing=None):
        self.default = default
        self.nothing = nothing
        self.value = default
        self.type_ = type(default)
        self.context = self.TYPE2CONTEXT

    def __get__(self, options, type_=None):
        context = self.TYPE2CONTEXT[self.type_](self)
        context.__doc__ = self.__doc__
        context.default = self.default
        context.nothing = self.nothing
        return context

    def __set__(self, options, value):
        self.value = self.type_(value)

    def __delete__(self, options):
        self.value = self.default


class Options(object):
    """Singleton class for `global` options placed in module |pub|.

    Note that Most options are simple True/False or 0/1 flags.

    You can change all options in two ways.  By using the `with` statement,
    you make sure that the change is undone after leaving the corresponding
    code block (even if an error occurs):

    >>> from hydpy.pub import options
    >>> options.printprogress = 0
    >>> options.printprogress
    0
    >>> with options.printprogress(True):
    ...     print(options.printprogress)
    1
    >>> options.printprogress
    0

    Alternatively, you can change all options via simple assignements:

    >>> options.printprogress = True
    >>> options.printprogress
    1

    But then you might have to keep in mind to undo the change later:

    >>> options.printprogress
    1
    >>> options.printprogress = False
    >>> options.printprogress
    0
    """

    checkseries = _Option(True, None)
    """True/False flag indicating whether an error shall be raised
    when e.g. an incomplete input time series, not spanning the whole
    initialization time period, is loaded."""

    ellipsis = _Option(-999, -999)
    """Ellipsis points are used to shorten the string representations
    of iterable HydPy objects containing many entries.  Set a value
    to define the maximum number of entries before and behind ellipsis
    points.  Set it to zero, if no ellipsis points should be drawn at
    all.  Set it to -999 (the default value) to rely on the default
    values of the respective iterables."""
    ellipsis.type_ = int

    fastcython = _Option(True, None)
    """True/False flag indicating whether Cythonization shall be
    configured in a fast but unsafe (True) or in a slow but safe (False)
    mode.  The fast mode is the default.  Setting this flag to False
    can be helpful when the implementation of new models or other
    Cython related features introduces errors that do not result in
    informative error messages."""

    printprogress = _Option(True, None)
    """True/False flag indicating whether information about the progress
    of certain processes shall be printed to the standard output or not.
    The default is `True`."""

    printincolor = _Option(True, None)
    """True/False flag indicating whether information shall be printed
    in color eventually or not. The default is `True`."""

    reprcomments = _Option(False, None)
    """True/False flag indicationg whether comments shall be included
    in string representations of some classes of the HydPy framework or
    not.  The default is `False`."""

    reprdigits = _Option(-999, -999)
    """Required precision of string representations of floating point
    numbers, defined as the minimum number of digits to be reproduced
    by the string representation (see function |repr_|)."""

    skipdoctests = _Option(False, None)
    """True/False flag indicating whether documetation tests shall be
    performed under certain situations.  Applying tests increases
    reliabilty and is thus the default."""

    usecython = _Option(True, None)
    """True/False flag indicating whether Cython models (True) or pure
    Python models (False) shall be applied if possible.  Using Cython
    models is more time efficient and thus the default."""

    usedefaultvalues = _Option(False, None)
    """True/False flag indicating whether parameters values shall be
    initialized with standard values or not."""

    dirverbose = _Option(False, None)
    """True/False flag indicationg whether the listboxes for the member
    selection of the classes of the HydPy framework should be complete
    (True) or restrictive (False).  The latter is more viewable and hence
    the default."""

    warnmissingcontrolfile = _Option(False, None)
    """True/False flag indicating whether only a warning shall be raised
    when a required control file is missing, or an exception."""

    warnmissingobsfile = _Option(True, None)
    """True/False flag indicating whether a warning shall be raised
    when a requested observation sequence demanded by a node instance
    is missing."""

    warnmissingsimfile = _Option(True, None)
    """True/False flag indicating whether a warning shall be raised
    when a requested simulation sequence demanded by a node instance
    is missing."""

    warnsimulationstep = _Option(True, None)
    """True/False flag indicating whether a warning shall be raised
    when function |simulationstep| called for the first time."""

    warntrim = _Option(True, None)
    """True/False flag indicating whether a warning shall be raised
    whenever certain values needed to be trimmed due to violating
    certain boundaries. Such warnings increase safety and are thus
    the default is `True`.  However, to cope with the limited precision
    of floating point numbers only those violations beyond a small
    tolerance value are reported (see function |trim|).  Warnings
    with identical information are reported only once."""


@autodoctools.make_autodoc_optional
def _prepare_docstrings():
    """Assign docstrings to the corresponding attributes of class `Options`
     to make them available in the interactive mode of Python."""
    source = inspect.getsource(Options)
    docstrings = source.split('"""')[3::2]
    attributes = [line.strip().split()[0] for line in source.split('\n')
                  if '_Option(' in line]
    for attribute, docstring in zip(attributes, docstrings):
        Options.__dict__[attribute].__doc__ = docstring


_prepare_docstrings()

autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/parametertools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
1745  
1746  
1747  
1748  
1749  
1750  
1751  
1752  
1753  
1754  
1755  
1756  
1757  
1758  
1759  
1760  
1761  
1762  
1763  
1764  
1765  
1766  
1767  
1768  
1769  
1770  
1771  
1772  
1773  
1774  
1775  
1776  
1777  
1778  
1779  
1780  
1781  
1782  
1783  
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  
1792  
1793  
1794  
1795  
1796  
1797  
1798  
1799  
1800  
1801  
1802  
1803  
1804  
1805  
1806  
1807  
1808  
1809  
1810  
1811  
1812  
1813  
1814  
1815  
1816  
1817  
1818  
1819  
1820  
1821  
1822  
1823  
1824  
1825  
1826  
1827  
1828  
1829  
1830  
1831  
1832  
1833  
1834  
1835  
1836  
1837  
1838  
1839  
1840  
1841  
1842  
1843  
1844  
1845  
1846  
1847  
1848  
1849  
1850  
1851  
1852  
1853  
1854  
1855  
1856  
1857  
1858  
1859  
1860  
1861  
1862  
1863  
1864  
1865  
1866  
1867  
1868  
1869  
1870  
1871  
1872  
1873  
1874  
1875  
1876  
1877  
1878  
1879  
1880  
1881  
1882  
1883  
1884  
1885  
1886  
1887  
1888  
1889  
1890  
1891  
1892  
1893  
1894  
1895  
1896  
1897  
1898  
1899  
1900  
1901  
1902  
1903  
1904  
1905  
1906  
1907  
1908  
1909  
1910  
1911  
1912  
1913  
1914  
1915  
1916  
1917  
# -*- coding: utf-8 -*-
"""This module implements tools for handling the parameters of
hydrological models.
"""
# import...
# ...standard
from __future__ import division, print_function
import inspect
import time
import warnings
# ...third party
import numpy
# ...HydPy specific
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import filetools
from hydpy.core import objecttools
from hydpy.core import timetools
from hydpy.core import variabletools

# The import of `_strptime` is not thread save.  The following call of
# `strptime` is supposed to prevent possible problems arising from this bug.
time.strptime('1999', '%Y')


def header_controlfile(model, parameterstep=None, simulationstep=None):
    """Return the header of a normal or auxiliariy parameter control file.

    The header contains the default coding information, the import command
    for the given model and the actual parameter and simulationstep step sizes.

    The first example shows that, if you pass the model argument as a
    string, you have to take care that this string make sense:

    >>> from hydpy.core.parametertools import header_controlfile
    >>> from hydpy import Period
    >>> print(header_controlfile(model='no model class',
    ...                          parameterstep='-1h',
    ...                          simulationstep=Period('1h')))
    # -*- coding: utf-8 -*-
    <BLANKLINE>
    from hydpy.models.no model class import *
    <BLANKLINE>
    simulationstep("1h")
    parameterstep("-1h")
    <BLANKLINE>
    <BLANKLINE>

    The second example shows the saver option to pass the proper model
    object.  It also shows that function |header_controlfile| tries to
    gain the parameter and simulation step sizes from the global
    |Timegrids| object contained in module |pub| when necessary:

    >>> from hydpy.models.lland_v1 import *
    >>> parameterstep('1d')
    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2001.01.01',
    ...                                    '1h'))
    >>> print(header_controlfile(model=model))
    # -*- coding: utf-8 -*-
    <BLANKLINE>
    from hydpy.models.lland_v1 import *
    <BLANKLINE>
    simulationstep("1h")
    parameterstep("1d")
    <BLANKLINE>
    <BLANKLINE>
    """
    with Parameter.parameterstep(parameterstep), \
            Parameter.simulationstep(simulationstep):
        return ('# -*- coding: utf-8 -*-\n\n'
                'from hydpy.models.%s import *\n\n'
                'simulationstep("%s")\n'
                'parameterstep("%s")\n\n'
                % (model, Parameter.simulationstep, Parameter.parameterstep))


class IntConstant(int):
    """Class for |int| objects with individual docstrings."""

    def __new__(cls, value):
        const = int.__new__(cls, value)
        const.__doc__ = None
        frame = inspect.currentframe().f_back
        const.__module__ = frame.f_locals['__name__']
        return const


class Constants(dict):
    """Base class for defining integer constants for a specific model."""

    def __init__(self, *args, **kwargs):
        frame = inspect.currentframe().f_back
        for (key, value) in frame.f_locals.items():
            if key.isupper() and isinstance(value, IntConstant):
                kwargs[key] = value
        dict.__init__(self, *args, **kwargs)
        self.__module__ = frame.f_locals['__name__']
        self._prepare_docstrings(frame)

    @autodoctools.make_autodoc_optional
    def _prepare_docstrings(self, frame):
        """Assign docstrings to the constants handled by |Constants|
        to make them available in the interactive mode of Python."""
        filename = inspect.getsourcefile(frame)
        sources = open(filename).read().split('"""')
        for code, doc in zip(sources[::2], sources[1::2]):
            code = code.strip()
            key = code.split('\n')[-1].split()[0]
            value = self.get(key)
            if value:
                value.__doc__ = doc


class Parameters(object):
    """Base class for handling all parameters of a specific model."""

    _names_subpars = ('control', 'derived', 'solver')

    def __init__(self, kwargs):
        self.model = kwargs.get('model')
        self.control = None
        self.derived = None
        self.solver = None
        cythonmodule = kwargs.get('cythonmodule')
        cymodel = kwargs.get('cymodel')
        for (name, cls) in kwargs.items():
            if name.endswith('Parameters') and issubclass(cls, SubParameters):
                if cythonmodule:
                    cls_fastaccess = getattr(cythonmodule, name)
                    subpars = cls(self, cls_fastaccess, cymodel)
                else:
                    subpars = cls(self, None, None)
                setattr(self, subpars.name, subpars)

    def update(self):
        """Call the update methods of all derived and solver parameters."""
        for subpars in self.secondary_subpars:
            for par in subpars._PARCLASSES:
                name = objecttools.instancename(par)
                try:
                    subpars.__dict__[name].update()
                except BaseException:
                    objecttools.augment_excmessage(
                        'While trying to update the %s parameter `%s` of '
                        'element `%s`'
                        % (name, subpars.name, objecttools.devicename(self)))

    def save_controls(self, filename=None, parameterstep=None,
                      simulationstep=None, auxfiler=None):
        if self.control:
            if not filename:
                filename = self._controldefaultfilename
            if auxfiler:
                variable2auxfile = getattr(auxfiler, str(self.model), None)
            else:
                variable2auxfile = None
            lines = [header_controlfile(
                     self.model, parameterstep, simulationstep)]
            for par in self.control:
                if variable2auxfile:
                    auxfilename = variable2auxfile.get_filename(par)
                    if auxfilename:
                        lines.append("%s(auxfile='%s')\n"
                                     % (par.name, auxfilename))
                        continue
                lines.append(repr(par) + '\n')
            pub.controlmanager.save_file(filename, ''.join(lines))

    @property
    def _controldefaultfilename(self):
        filename = objecttools.devicename(self)
        if filename == '?':
            raise RuntimeError(
                'To save the control parameters of a model to a file, its '
                'filename must be known.  This can be done, by passing '
                'filename to function `save_controls` directly.  '
                'But in complete HydPy applications, it is usally '
                'assumed to be consistent with the name of the element '
                'handling the model.  Actually, neither a filename is given '
                'nor does the model know its master element.')
        else:
            return filename + '.py'

    def verify(self):
        for parameter in self.control:
            parameter.verify()
        for parameter in self.derived:
            parameter.verify()

    @property
    def secondary_subpars(self):
        for subpars in (self.derived, self.solver):
            if subpars is not None:
                yield subpars

    def __iter__(self):
        for name in self._names_subpars:
            subpars = getattr(self, name)
            if subpars is not None:
                yield subpars

    def __len__(self):
        return len(dict(self))

    def __dir__(self):
        return objecttools.dir_(self)


class _MetaSubParametersType(type):

    def __new__(cls, name, parents, dict_):
        parclasses = dict_.get('_PARCLASSES')
        if parclasses is None:
            raise NotImplementedError(
                'For class `%s`, the required tuple `_PARCLASSES` is not '
                'defined.  Please see the documentation of class '
                '`SubParameters` of module `parametertools` for further '
                'information.' % name)
        if parclasses:
            lst = ['\n\n\n    The following parameter classes are selected:']
            for parclass in parclasses:
                lst.append('      * :class:`~%s` %s'
                           % ('.'.join((parclass.__module__,
                                        parclass.__name__)),
                              autodoctools.description(parclass)))
            doc = dict_.get('__doc__', None)
            if doc is None:
                doc = ''
            dict_['__doc__'] = doc + '\n'.join(l for l in lst)
        return type.__new__(cls, name, parents, dict_)


_MetaSubParametersClass = _MetaSubParametersType('_MetaSubParametersClass',
                                                 (), {'_PARCLASSES': ()})


class SubParameters(_MetaSubParametersClass):
    """Base class for handling subgroups of model parameters.

    When trying to implement a new model, one has to define its parameter
    classes.  Currently, the HydPy framework  distinguishes between control
    parameters and derived parameters.  These parameter classes should be
    collected by subclasses of class |SubParameters| called
    `ControlParameters` or `DerivedParameters` respectivly.  This should be
    done via the `_PARCLASSES` tuple in the following manner:

    >>> from hydpy.core.parametertools import SingleParameter, SubParameters
    >>> class Par2(SingleParameter):
    ...     pass
    >>> class Par1(SingleParameter):
    ...     pass
    >>> class ControlParameters(SubParameters):
    ...     _PARCLASSES = (Par2, Par1)

    The order within the tuple determines the order of iteration, e.g.:

    >>> control = ControlParameters(None) # Assign `None` for brevity.
    >>> control
    par2(nan)
    par1(nan)

    If one forgets to define a `_PARCLASSES` tuple so (and maybe tries to
    add the parameters in the constructor of the subclass of |SubParameters|,
    the following error is raised:

    >>> class ControlParameters(SubParameters):
    ...     pass
    Traceback (most recent call last):
    ...
    NotImplementedError: For class `ControlParameters`, the required \
tuple `_PARCLASSES` is not defined.  Please see the documentation of \
class `SubParameters` of module `parametertools` for further information.

    The `in` operator can be used to check if a certain |SubParameters|
    object handles a certain type of parameter:

    >>> Par1 in control
    True
    >>> Par1() in control
    True
    >>> SingleParameter in control
    False
    >>> 1 in control
    Traceback (most recent call last):
    ...
    TypeError: The given value `1` of type `int` is neither a \
parameter class nor a parameter instance.
    """
    _PARCLASSES = ()

    def __init__(self, pars, cls_fastaccess=None, cymodel=None):
        self.pars = pars
        if cls_fastaccess is None:
            self.fastaccess = objecttools.FastAccess()
        else:
            self.fastaccess = cls_fastaccess()
            setattr(cymodel.parameters, self.name, self.fastaccess)
        for par in self._PARCLASSES:
            setattr(self, objecttools.instancename(par), par())

    @classmethod
    def getname(cls):
        return objecttools.instancename(cls)[:-10]

    @property
    def name(self):
        return self.getname()

    def __setattr__(self, name, value):
        """Attributes and methods should usually not be replaced.  Existing
        |Parameter| attributes are protected in a way, that only their
        values are changed through assignements.  For new |Parameter|
        attributes, additional `fastaccess` references are defined.  If you
        actually want to replace a parameter, you have to delete it first.
        """
        try:
            attr = getattr(self, name)
        except AttributeError:
            object.__setattr__(self, name, value)
            if isinstance(value, abctools.ParameterABC):
                value.connect(self)
        else:
            try:
                attr._setvalue(value)
            except AttributeError:
                raise RuntimeError(
                    '`%s` instances do not allow the direct replacement of '
                    'their members.  After initialization you should usually '
                    'only change parameter values through assignements.  '
                    'If you really need to replace a object member, '
                    'delete it beforehand.' % objecttools.classname(self))

    def __iter__(self):
        for par in self._PARCLASSES:
            name = objecttools.instancename(par)
            yield getattr(self, name)

    def __contains__(self, parameter):
        if isinstance(parameter, abctools.ParameterABC):
            parameter = type(parameter)
        if parameter in self._PARCLASSES:
            return True
        try:
            if issubclass(parameter, abctools.ParameterABC):
                return False
        except TypeError:
            pass
        raise TypeError(
            'The given %s is neither a parameter class '
            'nor a parameter instance.'
            % objecttools.value_of_type(parameter))

    def __repr__(self):
        lines = []
        if pub.options.reprcomments:
            lines.append('# %s object defined in module %s.'
                         % (objecttools.classname(self),
                            objecttools.modulename(self)))
            lines.append('# The implemented parameters with their actual '
                         'values are:')
        for parameter in self:
            try:
                lines.append('%s' % repr(parameter))
            except BaseException:
                lines.append('%s(?)' % parameter.name)
        return '\n'.join(lines)

    def __dir__(self):
        return objecttools.dir_(self)


class _Period(timetools.Period):

    def __init__(self, stepsize=None):
        self.stepsize = stepsize
        timetools.Period.__init__(self, stepsize.period)
        self.old_period = timetools.Period(self)
        self.__doc__ = stepsize.__doc__

    def __enter__(self):
        return self

    def __call__(self, stepsize):
        if stepsize is not None:
            self.timedelta = stepsize
            self.stepsize.period.timedelta = stepsize
        return self

    def __exit__(self, type_, value, traceback):
        self.stepsize.period = self.old_period

    def check(self):
        if not self:
            raise RuntimeError(self.stepsize.EXC_MESSAGE)

    def delete(self):
        self.timedelta = None
        self.stepsize.period.timedelta = None
        return self


class _Stepsize(object):
    """Base class of the descriptor classes |Parameterstep| and
    |Simulationstep|."""

    def __init__(self):
        self.period = timetools.Period()

    def __set__(self, obj, value):
        self(value)

    def __delete__(self, obj):
        del self.period.timedelta

    def __call__(self, value):
        try:
            period = timetools.Period(value)
            if period >= '1s':
                self.period = period
            else:
                raise ValueError(
                    'The smallest step size allowed is one second.')
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to (re)define the general %s size with %s'
                % (self.name, objecttools.value_of_type(value)))

    @property
    def name(self):
        return objecttools.instancename(self)


class Parameterstep(_Stepsize):
    """The actual parameter time step size.

    Usually, the time step size of the units of certain parameters
    is defined within control files via function |parameterstep|.
    But it can also be changed interactively with the help of any
    |Parameter| object:

    >>> from hydpy.core.parametertools import Parameter
    >>> parameter = Parameter()
    >>> parameter.parameterstep = '1d'
    >>> parameter.parameterstep
    Period('1d')

    Note that setting the step size affects all parameters!

    Getting the step size via the |Parameter| subclasses themselves
    works also fine, but use a method call instead of an assignement to
    change the step size in order to prevent from overwriting the
    descriptor:

    >>> Parameter.parameterstep
    Period('1d')
    >>> Parameter.parameterstep('2d')
    Period('2d')

    Unreasonable assignements result in error messages like the following:

    >>> parameter.parameterstep = '0d'
    Traceback (most recent call last):
    ...
    ValueError: While trying to (re)define the general parameterstep size \
with value `0d` of type `str`, the following error occured: The smallest \
step size allowed is one second.

    After deleting the parameter step size, an empty period object is returned:

    >>> del parameter.parameterstep
    >>> ps = parameter.parameterstep
    >>> ps
    Period()

    In case you prefer an exception instead of an empty period object,
    call its `check` method:

    >>> ps.check()
    Traceback (most recent call last):
    ...
    RuntimeError: No general parameter step size has been defined.

    For temporary step size changes, Pythons `with` statement is supported:

    >>> parameter.parameterstep = '1d'
    >>> with parameter.parameterstep('2h'):
    ...     print(repr(parameter.parameterstep))
    Period('2h')
    >>> parameter.parameterstep
    Period('1d')

    Passing |None| means "change nothing in this context" (usefull for
    defining functions with optional `parameterstep` arguments):

    >>> with parameter.parameterstep(None):
    ...     print(repr(parameter.parameterstep))
    Period('1d')
    >>> parameter.parameterstep
    Period('1d')

    Deleting the stepsize temporarily, requires calling method `delete`:

    >>> with parameter.parameterstep.delete():
    ...     print(repr(parameter.parameterstep))
    Period()
    >>> parameter.parameterstep
    Period('1d')
    """

    EXC_MESSAGE = 'No general parameter step size has been defined.'

    def __get__(self, obj, cls):
        return _Period(self)


class Simulationstep(_Stepsize):
    """The actual (or surrogate) simulation time step size.

    .. testsetup::

       >>> from hydpy import pub
       >>> pub.timegrids = None
       >>> from hydpy.core.parametertools import Parameter
       >>> Parameter.simulationstep.delete()
       Period()

    Usually, the simulation step size is defined globally in module
    |pub| via a |Timegrids| object, or locally via function |simulationstep|
    in separate control files.  But you can also change it interactively
    with the help of |Parameter| objects.

    Generally, the documentation on class |Parameterstep| also holds
    true for class |Simulationstep|.  The following explanations
    focus on the differences only.

    As long as no usual or surrogate simulation time step is defined, an
    empty period object is returned, which can be used to raise the
    following exception:

    >>> from hydpy.core.parametertools import Parameter
    >>> parameter = Parameter()
    >>> ps = parameter.simulationstep
    >>> ps
    Period()
    >>> ps.check()
    Traceback (most recent call last):
    ...
    RuntimeError: Neither a global simulation time grid nor a general \
simulation step size to be used as a surrogate for testing purposes has \
been defined.

    For testing or documentation purposes a surrogate step size can be set:

    >>> parameter.simulationstep = '1d'
    >>> parameter.simulationstep
    Period('1d')

    But in complete HydPy applications, changing the simulation step
    size  would be highly error prone.  Hence, being defined globally
    within the |pub| module, predefined surrogate values are ignored:

    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2001.01.01',
    ...                                    '2h'))
    >>> parameter.simulationstep
    Period('2h')

    This priority remains unchanged, even when one tries to set a surrogate
    value after the timegrid object has been defined:

    >>> parameter.simulationstep = '5s'
    >>> parameter.simulationstep
    Period('2h')

    One has to delete the timegrid object to make the surrogate simulation
    step size accessible:

    >>> del pub.timegrids
    >>> parameter.simulationstep
    Period('5s')
    """
    EXC_MESSAGE = ('Neither a global simulation time grid nor a general '
                   'simulation step size to be used as a surrogate for '
                   'testing purposes has been defined.')

    def __get__(self, obj, cls):
        period = _Period(self)
        try:
            period.timedelta = pub.timegrids.stepsize
        except AttributeError:
            pass
        return period


class Parameter(variabletools.Variable):
    """Base class for |SingleParameter| and |MultiParameter|."""

    NOT_DEEPCOPYABLE_MEMBERS = ('subpars', 'fastaccess')

    parameterstep = Parameterstep()
    simulationstep = Simulationstep()

    def __init__(self):
        self.subpars = None
        self.fastaccess = objecttools.FastAccess()

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |Parameter| instances
        within parameter control files.
        """
        if args and kwargs:
            raise ValueError('For parameter %s of element %s both positional '
                             'and keyword arguments are given, which is '
                             'ambiguous.'
                             % (self.name, objecttools.devicename(self)))
        elif not args and not kwargs:
            raise ValueError('For parameter %s of element %s neither a '
                             'positional nor a keyword argument is given.'
                             % (self.name, objecttools.devicename(self)))
        elif 'pyfile' in kwargs:
            warnings.warn(objecttools.HydPyDeprecationWarning(
                'The keyword name to define a parameter value in an auxiliary '
                'control file is now `auxfile`.  The old keyword name '
                '`pyfile` will be banned in the future.'))
            values = self._getvalues_from_auxiliaryfile(kwargs['pyfile'])
            self.values = self.apply_timefactor(values)
            del kwargs['pyfile']
        elif 'auxfile' in kwargs:
            values = self._getvalues_from_auxiliaryfile(kwargs['auxfile'])
            self.values = self.apply_timefactor(values)
            del kwargs['auxfile']
        elif args:
            self.values = self.apply_timefactor(numpy.array(args))
        else:
            raise NotImplementedError('The value(s) of parameter %s of '
                                      'element %s could not be set based on '
                                      'the given keyword arguments.'
                                      % (self.name,
                                         objecttools.devicename(self)))
        self.trim()

    def _getvalues_from_auxiliaryfile(self, pyfile):
        """Tries to return the parameter values from the auxiliary control file
        with the given name.

        Things are a little complicated here.  To understand this method, you
        should first take a look at function |parameterstep|.
        """
        frame = inspect.currentframe().f_back.f_back
        while frame:
            namespace = frame.f_locals
            try:
                subnamespace = {'model': namespace['model'],
                                'focus': self}
                break
            except KeyError:
                frame = frame.f_back
        else:
            raise RuntimeError('Something has gone wrong when trying to '
                               'read parameter `%s` from file `%s`.'
                               % (self.name, pyfile))
        filetools.ControlManager.read2dict(pyfile, subnamespace)
        try:
            subself = subnamespace[self.name]
        except KeyError:
            raise RuntimeError('Something has gone wrong when trying to '
                               'read parameter `%s` from file `%s`.'
                               % (self.name, pyfile))
        return subself.values

    @property
    def initvalue(self):
        """Actual initial value of the given parameter.

        Some |Parameter| subclasses define a class attribute `INIT`.
        Let's define a test class and prepare a function for initializing
        a parameter object and connecting it to a |SubParameters| object:

        >>> from hydpy.core import parametertools
        >>> class Test(parametertools.SingleParameter):
        ...     NDIM, TYPE, TIME, SPAN = 0, float, None, (None, None)
        ...     INIT = 2.0
        >>> def prepare():
        ...     test = Test()
        ...     from hydpy.core.parametertools import SubParameters
        ...     subpars = parametertools.SubParameters(None)
        ...     test.connect(subpars)
        ...     return test

        By default, making use of the `INIT` attribute is disabled:

        >>> test = prepare()
        >>> test
        test(nan)

        This can be changed through setting |Options.usedefaultvalues| to
        `True`:

        >>> from hydpy import pub
        >>> pub.options.usedefaultvalues = True
        >>> test = prepare()
        >>> test
        test(2.0)

        When no `INIT` attribute is defined, enabling
        |Options.usedefaultvalues| has no effect, of course:

        >>> del Test.INIT
        >>> test = prepare()
        >>> test
        test(nan)

        For time dependent parameter values, the `INIT` attribute is assumed
        to be related to a |Parameterstep| of one day:

        >>> test.parameterstep = '2d'
        >>> test.simulationstep = '12h'
        >>> Test.INIT = 2.0
        >>> Test.TIME = True
        >>> test = prepare()
        >>> test
        test(4.0)
        >>> test.value
        1.0

        Note the following `nan` surrogate values for types |bool| and
        |int| (for |bool|, a better solution should be found):

        >>> Test.TIME = None
        >>> Test.TYPE = bool
        >>> del Test.INIT
        >>> test = prepare()
        >>> test
        test(False)
        >>> Test.TYPE = int
        >>> test = prepare()
        >>> test
        test(-999999)

        For not supported types, the following error message is raised:

        >>> Test.TYPE = list
        >>> test = prepare()
        Traceback (most recent call last):
        ...
        AttributeError: For parameter `test` no `INIT` class attribute is \
defined, but no standard value for its TYPE `list` is available
        """
        initvalue = (getattr(self, 'INIT', None) if
                     pub.options.usedefaultvalues else None)
        if initvalue is None:
            type_ = getattr(self, 'TYPE', float)
            if type_ is float:
                initvalue = numpy.nan
            elif type_ is int:
                initvalue = variabletools._INT_NAN
            elif type_ is bool:
                initvalue = False
            else:
                raise AttributeError(
                    'For parameter `%s` no `INIT` class attribute is defined, '
                    'but no standard value for its TYPE `%s` is available'
                    % (self.name, objecttools.classname(type_)))
        else:
            with Parameter.parameterstep('1d'):
                initvalue = self.apply_timefactor(initvalue)
        return initvalue

    def _gettimefactor(self):
        """Factor to adapt a new parameter value related to |parameterstep|
        to a different simulation time step.
        """
        try:
            parfactor = pub.timegrids.parfactor
        except AttributeError:
            if not self.simulationstep:
                raise RuntimeError(
                    'The calculation of the effective value of parameter '
                    '`%s` requires a definition of the actual simulation time '
                    'step.  The simulation time step is project specific.  '
                    'When initializing the HydPy framework, it is '
                    'automatically specified under `pub.timegrids.stepsize`.  '
                    'For testing purposes, one can e.g. alternatively apply '
                    'the function `simulationstep`.  Please see the '
                    'documentation for more details.' % self.name)
            else:
                date1 = timetools.Date('2000.01.01')
                date2 = date1 + self.simulationstep
                parfactor = timetools.Timegrids(timetools.Timegrid(
                    date1, date2, self.simulationstep)).parfactor
        return parfactor(self.parameterstep)

    timefactor = property(_gettimefactor)

    def trim(self, lower=None, upper=None):
        """Apply |trim| of module |variabletools|."""
        variabletools.trim(self, lower, upper)

    def warn_trim(self):
        warnings.warn(
            'For parameter %s of element %s at least one value '
            'needed to be trimmed.  Two possible reasons could be '
            'that the a parameter bound violated or that the values '
            'of two (or more) different parameters are inconsistent.'
            % (self.name, objecttools.devicename(self)))

    def apply_timefactor(self, values):
        """Change the given parameter value/values in accordance with the
        actual parameter simulation time step if necessary, and return it/them.
        """
        # Note: At least `values /= self.timefactor` is less flexible than
        # `values = values / self.timefactor` regarding the type of `values`.
        if self.TIME is True:
            values = values * self.timefactor
        elif self.TIME is False:
            values = values / self.timefactor
        return values

    def revert_timefactor(self, values):
        """Change the given parameter value/values inversely in accordance
        with the actual parameter simulation time step if necessary, and
        return it/them.
        """
        # Note: At least `values /= self.timefactor` is less flexible than
        # `values = values / self.timefactor` regarding the type of `values`.
        if self.TIME is True:
            values = values / self.timefactor
        elif self.TIME is False:
            values = values * self.timefactor
        return values

    def commentrepr(self):
        """Returns a list with comments, e.g. for making string
        representations more informative.  When |Options.reprcomments|
        is set to |False|, an empty list is returned.
        """
        lines = variabletools.Variable.commentrepr(self)
        if (pub.options.reprcomments and
                (getattr(self, 'TIME', None) is not None)):
            lines.append('# The actual value representation depends on '
                         'the actual parameter step size,')
            lines.append('# which is `%s`.' % self.parameterstep)
        return lines

    def __str__(self):
        return str(self.values)

    def __dir__(self):
        return objecttools.dir_(self)


abctools.ParameterABC.register(Parameter)


class SingleParameter(Parameter):
    """Base class for model parameters handling a single value."""
    NDIM, TYPE, TIME, SPAN, INIT = 0, float, None, (None, None), None

    def connect(self, subpars):
        self.subpars = subpars
        self.fastaccess = subpars.fastaccess
        setattr(self.fastaccess, self.name, self.initvalue)

    def _getshape(self):
        """An empty tuple.  (Only intended for increasing consistent usability
        of |SingleParameter| and |MultiParameter| instances.)
        """
        return ()

    def _setshape(self, shape):
        raise RuntimeError('The shape information of `SingleParameters` '
                           'as `%s` cannot be changed.' % self.name)

    shape = property(_getshape, _setshape)

    def _getvalue(self):
        """The actual parameter value handled by the respective
        |SingleParameter| instance.
        """
        return getattr(self.fastaccess, self.name, numpy.nan)

    def _setvalue(self, value):
        try:
            temp = value[0]
            if len(value) > 1:
                raise ValueError('%d values are assigned to the scalar '
                                 'parameter `%s`, which is ambiguous.'
                                 % (len(value)), self.name)
            value = temp
        except (TypeError, IndexError):
            pass
        try:
            value = self.TYPE(value)
        except (ValueError, TypeError):
            raise TypeError('When trying to set the value of parameter `%s`, '
                            'it was not possible to convert `%s` to type '
                            '`%s`.' % (self.name, value,
                                       objecttools.classname(self.TYPE)))
        setattr(self.fastaccess, self.name, value)

    value = property(_getvalue, _setvalue)
    values = value

    def verify(self):
        """Raises a |RuntimeError| if the value of the instance of the
        respective subclass of |SingleParameter| is `nan`.
        """
        if numpy.isnan(self.value):
            raise RuntimeError('The value of parameter `%s` has not been '
                               'set yet.' % self.name)

    def __len__(self):
        """Returns 1.  (This method is only intended for increasing consistent
        usability of |SingleParameter| and |MultiParameter| instances.)
        """
        return 1

    def __getitem__(self, key):
        if key in (0, slice(None, None, None)):
            return self.value
        else:
            raise IndexError('The only allowed index for scalar parameters '
                             'like `%s` is `0` (or `:`), but `%s` is given.'
                             % (self.name, key))

    def __setitem__(self, key, value):
        if key in (0, slice(None, None, None)):
            self.value = value
        else:
            raise IndexError('The only allowed index for scalar parameters '
                             'like `%s` is `0` (or `:`), but `%s` is given.'
                             % (self.name, key))

    def __repr__(self):
        lines = self.commentrepr()
        lines.append('%s(%s)'
                     % (self.name,
                        objecttools.repr_(self.revert_timefactor(self.value))))
        return '\n'.join(lines)


class MultiParameter(Parameter):
    """Base class for model parameters handling multiple values."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)

    def connect(self, subpars):
        self.subpars = subpars
        self.fastaccess = subpars.fastaccess
        setattr(self.fastaccess, self.name, None)

    def _getshape(self):
        """A tuple containing the lengths in all dimensions of the parameter
        values.  Note that setting a new shape results in a loss of all values
        of the respective parameter.
        """
        try:
            shape = getattr(self.fastaccess, self.name).shape
            return tuple(int(x) for x in shape)
        except AttributeError:
            raise RuntimeError('Shape information for parameter `%s` '
                               'can only be retrieved after it has been '
                               'defined.' % self.name)

    def _setshape(self, shape):
        try:
            array = numpy.full(shape, self.initvalue, dtype=self.TYPE)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying create a new numpy ndarray` for parameter `%s`'
                % self.name)
        if array.ndim == self.NDIM:
            setattr(self.fastaccess, self.name, array)
        else:
            raise ValueError(
                'Parameter `%s` is %d-dimensional but the '
                'given shape indicates %d dimensions.'
                % (self.name, self.NDIM, array.ndim))

    shape = property(_getshape, _setshape)

    def _getvalue(self):
        """The actual parameter value(s) handled by the respective
        |Parameter| instance.  For consistency, `value` and `values`
        can always be used interchangeably.
        """
        value = getattr(self.fastaccess, self.name, None)
        if value is None:
            return value
        return numpy.asarray(value)

    def _setvalue(self, value):
        try:
            value = value.value
        except AttributeError:
            pass
        try:
            value = numpy.full(self.shape, value, dtype=self.TYPE)
        except ValueError:
            raise ValueError(
                'The values `%s` cannot be converted to a numpy ndarray '
                'with shape %s containing entries of type %s.'
                % (value, self.shape, objecttools.classname(self.TYPE)))
        setattr(self.fastaccess, self.name, value)

    value = property(_getvalue, _setvalue)
    values = value

    def _getverifymask(self):
        """A numpy array with all entries being |True| of the same
        shape as the values handled by the respective parameter.  All entries
        being |True| indicates that the method |MultiParameter.verify|
        checks all entries of the numpy array storing the parameter values.
        Overwrite |MultiParameter.verify| for |MultiParameter|
        subclasses, where certain entries do not to be checked.
        """
        return numpy.full(self.shape, True, dtype=bool)

    verifymask = property(_getverifymask)

    def verify(self):
        """Raises a |RuntimeError| if at least one of the required values
        of the instance of the respective subclass of |MultiParameter| is
        |None| or |numpy.nan|. The property |MultiParameter.verifymask|
        defines, which values are considered to be necessary.
        """
        if self.values is None:
            raise RuntimeError(
                'The values of parameter `%s` have not been set yet.'
                % self.name)
        nmbnan = sum(numpy.isnan(self.values[self.verifymask]))
        if nmbnan:
            raise RuntimeError(
                'For parameter `%s`, %d required values have '
                'not been set yet.'
                % (self.name, nmbnan))

    def __len__(self):
        """Returns the number of values handled by the |MultiParameter|
        instance.  It is required, that the `shape` has been set beforehand,
        which specifies the length in each dimension.
        """
        return numpy.cumprod(self.shape)[-1]

    def __getitem__(self, key):
        try:
            return self.values[key]
        except BaseException:
            self._raiseitemexception()

    def __setitem__(self, key, values):
        try:
            self.values[key] = values
        except BaseException:
            self._raiseitemexception()

    def _raiseitemexception(self):
        if self.values is None:
            raise RuntimeError(
                'Parameter `%s` has no values so far.'
                % self.name)
        else:
            objecttools.augment_excmessage(
                'While trying to item access the values of parameter `%s`'
                % self.name)

    def compress_repr(self):
        """Returns a compressed parameter value string, which is (in
        accordance with |MultiParameter.NDIM|) contained in a nested list.
        If the compression fails, a |NotImplementedError| is raised.
        """
        if self.value is None:
            unique = numpy.array([numpy.nan])
        elif self.length == 0:
            return ['']
        else:
            unique = numpy.unique(self.values)
        if sum(numpy.isnan(unique)) == len(unique.flatten()):
            unique = numpy.array([numpy.nan])
        else:
            unique = self.revert_timefactor(unique)
        if len(unique) == 1:
            result = objecttools.repr_(unique[0])
            for dummy in range(self.NDIM):
                result = [result]
            return result
        else:
            raise NotImplementedError(
                'For parameter `%s` there is no compression method '
                'implemented, working for its actual values.'
                % self.name)

    def __repr__(self):
        try:
            values = self.compress_repr()
        except NotImplementedError:
            islong = self.length > 255
            values = self.revert_timefactor(self.values)
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to find a compressed '
                'string representation for parameter `%s`'
                % self.name)
        else:
            islong = False
        return Parameter.repr_(self, values, islong)


class ZipParameter(MultiParameter):
    """Base class for model parameters handling multiple values that
    offers additional keyword zipping fuctionality.

    When inheriting an actual parameter class from |ZipParameter| one
    needs to define suitable class constants |ZipParameter.REQUIRED_VALUES|
    (a |tuple|) and |ZipParameter.MODEL_CONSTANTS| (a |dict|).
    Additionally, a property named `refparameter` must be defined.

    The implementation and functioning of subclasses of |ZipParameter|
    is best illustrated by an example: see the documentation of the class
    |MultiParameter| of the HydPy-H-Land model.
    """
    REQUIRED_VALUES = ()
    MODEL_CONSTANTS = {}

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |Parameter| instances
        within parameter control files.
        """
        try:
            Parameter.__call__(self, *args, **kwargs)
        except NotImplementedError as exc:
            if kwargs:
                refvalues = self.refparameter.values
                if min(refvalues) < 1:
                    raise RuntimeError(
                        'Parameter %s does not seem to be prepared properly '
                        'for element %s.  Hence, setting values for '
                        'parameter %s via keyword arguments is not possible.'
                        % (self.refparameter.name,
                           objecttools.devicename(self),
                           self.name))
                self.values = kwargs.pop('default', numpy.nan)
                for (key, value) in kwargs.items():
                    sel = self.MODEL_CONSTANTS.get(key.upper())
                    if sel is None:
                        raise exc
                    else:
                        self.values[refvalues == sel] = value
                self.values = self.apply_timefactor(self.values)
                self.trim()
            else:
                raise exc

    def _getshape(self):
        """Return a tuple containing the lengths in all dimensions of the
        parameter values.
        """
        try:
            return MultiParameter._getshape(self)
        except RuntimeError:
            raise RuntimeError('Shape information for parameter `%s` can '
                               'only be retrieved after it has been defined. '
                               ' You can do this manually, but usually it is '
                               'done automatically by defining the value of '
                               'parameter `%s` first in each parameter '
                               'control file.'
                               % (self.name, self.shapeparameter.name))

    shape = property(_getshape, MultiParameter._setshape)

    def _getverifymask(self):
        """A numpy array of the same shape as the value array handled
        by the respective parameter.  `True` entries indicate that certain
        parameter values are required, which depends on the tuple
        `REQUIRED_VALUES` of the respective subclass.
        """
        mask = numpy.full(self.shape, False, dtype=bool)
        refvalues = self.refparameter.values
        for reqvalue in self.REQUIRED_VALUES:
            mask[refvalues == reqvalue] = True
        return mask

    verifymask = property(_getverifymask)

    def compress_repr(self):
        """Return a compressed parameter value string, which is (in
        accordance with `NDIM`) contained in a nested list.  If the
        compression fails, a |NotImplementedError| is raised.
        """
        try:
            return MultiParameter.compress_repr(self)
        except NotImplementedError as exc:
            results = []
            refvalues = self.refparameter.values
            if min(refvalues) < 1:
                raise NotImplementedError('Parameter %s is not defined '
                                          'poperly, which circumvents finding '
                                          'a suitable compressed.')
            for (key, value) in self.MODEL_CONSTANTS.items():
                if value in self.REQUIRED_VALUES:
                    unique = numpy.unique(self.values[refvalues == value])
                    unique = self.revert_timefactor(unique)
                    if len(unique) == 1:
                        results.append('%s=%s'
                                       % (key.lower(),
                                          objecttools.repr_(unique[0])))
                    elif len(unique) > 1:
                        raise exc
            result = ', '.join(sorted(results))
            for dummy in range(self.NDIM):
                result = [result]
            return result


class SeasonalParameter(MultiParameter):
    """Class for the flexible handling of parameters with anual cycles.

    Let us prepare a 1-dimensional |SeasonalParameter| instance:

    >>> from hydpy.core.parametertools import SeasonalParameter
    >>> seasonalparameter = SeasonalParameter()
    >>> seasonalparameter.NDIM = 1

    For the following examples, we assume a simulation step size of one day:

    >>> seasonalparameter.simulationstep = '1d'

    To define its shape, the first entry of the assigned |tuple|
    object is ignored:

    >>> seasonalparameter.shape = (None,)

    Instead it is derived from the `simulationstep` defined above:

    >>> seasonalparameter.shape
    (366,)

    The annual pattern of seasonal parameters is defined through pairs of
    |TOY| objects and different values (e.g. of type |float|).  One can
    define them all at once in the following manner:

    >>> seasonalparameter(_1=2., _7_1=4., _3_1_0_0_0=5.)

    Note that, as |str| objects, all keywords in the call above would
    be proper |TOY| initialization arguments. If they are not properly
    written, the following exception is raised:

    >>> SeasonalParameter()(_a=1.)
    Traceback (most recent call last):
    ...
    ValueError: While trying to define the seasonal parameter value \
`seasonalparameter` of element `?` for time of year `_a`, the following \
error occured: While trying to retrieve the month for TOY (time of year) \
object based on the string `_a`, the following error occured: \
For TOY (time of year) objects, all properties must be of type `int`, \
but the value `a` of type `str` given for property `month` cannot be \
converted to `int`.

    As the following string representation shows, are the pairs of each
    |SeasonalParameter| instance automatically sorted:

    >>> seasonalparameter
    seasonalparameter(toy_1_1_0_0_0=2.0,
                      toy_3_1_0_0_0=5.0,
                      toy_7_1_0_0_0=4.0)

    By default, `toy` is used as a prefix string.  Using this prefix string,
    one can change the toy-value pairs via attribute access:

    >>> seasonalparameter.toy_1_1_0_0_0
    2.0
    >>> del seasonalparameter.toy_1_1_0_0_0
    >>> seasonalparameter.toy_2_1_0_0_0 = 2.
    >>> seasonalparameter
    seasonalparameter(toy_2_1_0_0_0=2.0,
                      toy_3_1_0_0_0=5.0,
                      toy_7_1_0_0_0=4.0)

    On applying function |len| on |SeasonalParameter| objects, the number
    of toy-value pairs is returned:

    >>> len(seasonalparameter)
    3

    New values are checked to be compatible predefined shape:

    >>> seasonalparameter.toy_1_1_0_0_0 = [1., 2.]
    Traceback (most recent call last):
    ...
    TypeError: While trying to add a new or change an existing toy-value \
pair for the seasonal parameter `seasonalparameter` of element `?`, the \
following error occured: float() argument must be a string or a number...
    >>> seasonalparameter = SeasonalParameter()
    >>> seasonalparameter.NDIM = 2
    >>> seasonalparameter.shape = (None, 3)
    >>> seasonalparameter.toy_1_1_0_0_0 = [1., 2.]
    Traceback (most recent call last):
    ...
    ValueError: While trying to add a new or change an existing toy-value \
pair for the seasonal parameter `seasonalparameter` of element `?`, the \
following error occured: could not broadcast input array from shape (2) \
into shape (3)
    >>> seasonalparameter.toy_1_1_0_0_0 = [1., 2., 3.]
    >>> seasonalparameter
    seasonalparameter(toy_1_1_0_0_0=[1.0, 2.0, 3.0])
    """
    def __init__(self):
        MultiParameter.__init__(self)
        self._toy2values = {}

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |Parameter| instances
        within parameter control files.
        """
        self._toy2values.clear()
        if self.NDIM == 1:
            self.shape = (None,)
        try:
            MultiParameter.__call__(self, *args, **kwargs)
            self._toy2values[timetools.TOY()] = self[0]
        except BaseException as exc:
            if kwargs:
                for (toystr, values) in kwargs.items():
                    try:
                        setattr(self, str(timetools.TOY(toystr)), values)
                    except BaseException:
                        objecttools.augment_excmessage(
                            'While trying to define the seasonal parameter '
                            'value `%s` of element `%s` for time of year `%s`'
                            % (self.name,
                               objecttools.devicename(self),
                               toystr))
                self.refresh()
            else:
                raise exc

    def refresh(self):
        """Update the actual simulation values based on the toy-value pairs.

        Usually, one does not need to call refresh explicitly, as it is
        called by methods __call__, __setattr__ and __delattr__ automatically,
        when required.

        Instantiate a 1-dimensional |SeasonalParameter| object:

        >>> from hydpy.core.parametertools import SeasonalParameter
        >>> sp = SeasonalParameter()
        >>> sp.simulationstep = '1d'
        >>> sp.NDIM = 1
        >>> sp.shape = (None,)

        When a |SeasonalParameter| object does not contain any toy-value
        pairs yet, the method |SeasonalParameter.refresh| sets all actual
        simulation values to zero:

        >>> sp.values = 1.
        >>> sp.refresh()
        >>> sp.values[0]
        0.0

        When there is only one toy-value pair, its values are taken for
        all actual simulation values:

        >>> sp.toy_1 = 2. # calls refresh automatically
        >>> sp.values[0]
        2.0

        Method |SeasonalParameter.refresh| performs a linear interpolation
        for the central time points of each simulation time step.  Hence,
        in the following example the original values of the toy-value pairs
        do not show up:

        >>> sp.toy_12_31 = 4.
        >>> from hydpy import round_
        >>> round_(sp.values[0])
        2.00274
        >>> round_(sp.values[-2])
        3.99726
        >>> sp.values[-1]
        3.0

        If one wants to preserve the original values in this example, one
        would have to set the corresponding toy instances in the middle of
        some simulation step intervals:

        >>> del sp.toy_1
        >>> del sp.toy_12_31
        >>> sp.toy_1_1_12 = 2
        >>> sp.toy_12_31_12 = 4.
        >>> sp.values[0]
        2.0
        >>> round_(sp.values[1])
        2.005479
        >>> round_(sp.values[-2])
        3.994521
        >>> sp.values[-1]
        4.0

        """
        if not len(self):
            self.values[:] = 0.
        elif len(self) == 1:
            values = list(self._toy2values.values())[0]
            self.values[:] = self.apply_timefactor(values)
        else:
            timegrid = timetools.Timegrid(
                timetools.TOY._STARTDATE+self.simulationstep/2,
                timetools.TOY._ENDDATE+self.simulationstep/2,
                self.simulationstep)
            for idx, date in enumerate(timegrid):
                values = self.interp(date)
                self.values[idx] = self.apply_timefactor(values)

    def interp(self, date):
        """Perform a linear value interpolation for a date defined by the
        passed |Date| object and return the result.

        Instantiate a 1-dimensional |SeasonalParameter| object:

        >>> sp = SeasonalParameter()
        >>> from hydpy import Date, Period
        >>> sp.simulationstep = Period('1d')
        >>> sp.NDIM = 1
        >>> sp.shape = (None,)

        Define three toy-value pairs:
        >>> sp(_1=2.0, _2=5.0, _12_31=4.0)

        Passing a |Date| object excatly matching a |TOY| object of course
        simply returns the associated value:

        >>> sp.interp(Date('2000.01.01'))
        2.0
        >>> sp.interp(Date('2000.02.01'))
        5.0
        >>> sp.interp(Date('2000.12.31'))
        4.0

        For all intermediate points, a linear interpolation is performed:

        >>> from hydpy import round_
        >>> round_(sp.interp(Date('2000.01.02')))
        2.096774
        >>> round_(sp.interp(Date('2000.01.31')))
        4.903226
        >>> round_(sp.interp(Date('2000.02.02')))
        4.997006
        >>> round_(sp.interp(Date('2000.12.30')))
        4.002994

        Linear interpolation is also allowed between the first and the
        last pair, when they do not capture the end points of the year:

        >>> sp(_1_2=2.0, _12_30=4.0)
        >>> round_(sp.interp(Date('2000.12.29')))
        3.99449
        >>> sp.interp(Date('2000.12.30'))
        4.0
        >>> round_(sp.interp(Date('2000.12.31')))
        3.333333
        >>> round_(sp.interp(Date('2000.01.01')))
        2.666667
        >>> sp.interp(Date('2000.01.02'))
        2.0
        >>> round_(sp.interp(Date('2000.01.03')))
        2.00551

        The following example briefly shows interpolation performed for
        2-dimensional parameter:

        >>> sp = SeasonalParameter()
        >>> from hydpy import Date, Period
        >>> sp.simulationstep = Period('1d')
        >>> sp.NDIM = 2
        >>> sp.shape = (None, 2)
        >>> sp(_1_1=[1., 2.], _1_3=[-3, 0.])
        >>> result = sp.interp(Date('2000.01.02'))
        >>> round_(result[0])
        -1.0
        >>> round_(result[1])
        1.0
    """
        xnew = timetools.TOY(date)
        xys = list(self)
        for idx, (x_1, y_1) in enumerate(xys):
            if x_1 > xnew:
                x_0, y_0 = xys[idx-1]
                break
        else:
            x_0, y_0 = xys[-1]
            x_1, y_1 = xys[0]
        return y_0+(y_1-y_0)/(x_1-x_0)*(xnew-x_0)

    def _setshape(self, shape):
        try:
            shape = (int(shape),)
        except TypeError:
            pass
        shape = list(shape)
        if not self.simulationstep:
            raise RuntimeError(
                'It is not possible the set the shape of the seasonal '
                'parameter `%s` of element `%s` at the moment.  You can '
                'define it manually.  In complete HydPy projects it is '
                'indirectly defined via `pub.timegrids.stepsize` '
                'automatically.'
                % (self.name, objecttools.devicename(self)))
        shape[0] = timetools.Period('366d')/self.simulationstep
        shape[0] = int(numpy.ceil(round(shape[0], 10)))
        MultiParameter._setshape(self, shape)

    shape = property(MultiParameter._getshape, _setshape)

    def __iter__(self):
        for toy in sorted(self._toy2values.keys()):
            yield (toy, self._toy2values[toy])

    def __getattribute__(self, name):
        if name.startswith('toy_'):
            try:
                return self._toy2values[timetools.TOY(name)]
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to get an existing toy-value pair for '
                    'the seasonal parameter `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))
        else:
            return MultiParameter.__getattribute__(self, name)

    def __setattr__(self, name, value):
        if name.startswith('toy_'):
            try:
                if self.NDIM == 1:
                    value = float(value)
                else:
                    value = numpy.full(self.shape[1:], value)
                self._toy2values[timetools.TOY(name)] = value
                self.refresh()
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to add a new or change an existing '
                    'toy-value pair for the seasonal parameter `%s` of '
                    'element `%s`' % (self.name, objecttools.devicename(self)))
        else:
            MultiParameter.__setattr__(self, name, value)

    def __delattr__(self, name):
        if name.startswith('toy_'):
            try:
                del self._toy2values[timetools.TOY(name)]
                self.refresh()
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to delete an existing toy-value pair for '
                    'the seasonal parameter `%s` of element `%s`'
                    % (self.name, objecttools.devicename(self)))
        else:
            MultiParameter.__delattr__(self, name)

    def __repr__(self):
        if self.NDIM == 1:
            assign = objecttools.assignrepr_value
        elif self.NDIM == 2:
            assign = objecttools.assignrepr_list
        elif self.NDIM == 3:
            assign = objecttools.assignrepr_list2
        else:
            def assign(values, prefix):
                return prefix+str(values)
        if not len(self):
            return self.name+'()'
        lines = []
        blanks = ' '*(len(self.name)+1)
        for idx, (toy, value) in enumerate(self):
            if idx == 0:
                prefix = '%s(%s=' % (self.name, toy)
            else:
                prefix = '%s%s=' % (blanks, toy)
            lines.append(assign(value, prefix, width=79))
        lines[-1] += ')'
        return ',\n'.join(lines)

    def __len__(self):
        return len(self._toy2values)

    def __dir__(self):
        return objecttools.dir_(self) + [str(toy) for (toy, dummy) in self]


class KeywordParameter2DType(type):
    """Add the construction of `_ROWCOLMAPPING` to :class:`type`."""

    def __new__(cls, name, parents, dict_):
        rownames = dict_.get('ROWNAMES', getattr(parents[0], 'ROWNAMES', ()))
        colnames = dict_.get('COLNAMES', getattr(parents[0], 'COLNAMES', ()))
        rowcolmappings = {}
        for (idx, rowname) in enumerate(rownames):
            for (jdx, colname) in enumerate(colnames):
                rowcolmappings['_'.join((rowname, colname))] = (idx, jdx)
        dict_['_ROWCOLMAPPINGS'] = rowcolmappings
        return type.__new__(cls, name, parents, dict_)


KeywordParameter2DMetaclass = KeywordParameter2DType(
    'KeywordParameter2DMetaclass', (MultiParameter,), {})


class KeywordParameter2D(KeywordParameter2DMetaclass):
    """Base class for 2-dimensional model parameters which values which depend
    on two factors.

    When inheriting an actual parameter class from |KeywordParameter2D|
    one needs to define the class attributes |KeywordParameter2D.ROWNAMES|
    and |KeywordParameter2D.COLNAMES| (both of type |tuple|).  One usual
    setting would be that |KeywordParameter2D.ROWNAMES| defines some land
    use classes and |KeywordParameter2D.COLNAMES| defines seasons, months,
    or the like.

    Consider the following example, where the boolean parameter `IsWarm` both
    depends on the half-year period and the hemisphere:

    >>> from hydpy.core.parametertools import KeywordParameter2D
    >>> class IsWarm(KeywordParameter2D):
    ...     TYPE = bool
    ...     ROWNAMES = ('north', 'south')
    ...     COLNAMES = ('apr2sep', 'oct2mar')

    Instantiate the defined parameter class and define its shape:

    >>> iswarm = IsWarm()
    >>> iswarm.shape = (2, 2)

    |KeywordParameter2D| allows to set the values of all rows via
    keyword arguments:

    >>> iswarm(north=[True, False],
    ...        south=[False, True])
    >>> iswarm
    iswarm(north=[True, False],
           south=[False, True])
    >>> iswarm.values
    array([[ True, False],
           [False,  True]], dtype=bool)

    If a keyword is missing, a |TypeError| is raised:

    >>> iswarm(north=[True, False])
    Traceback (most recent call last):
    ...
    ValueError: When setting parameter `iswarm` of element `?` via row \
related keyword arguments, each string defined in `ROWNAMES` must be used \
as a keyword, but the following keyword is not: `south`.

    But one can modify single rows via attribute access:

    >>> iswarm.north = False, False
    >>> iswarm.north
    array([False, False], dtype=bool)

    The same holds true for the columns:

    >>> iswarm.apr2sep = True, False
    >>> iswarm.apr2sep
    array([ True, False], dtype=bool)

    Even a combined row-column access is supported in the following manner:

    >>> iswarm.north_apr2sep
    True
    >>> iswarm.north_apr2sep = False
    >>> iswarm.north_apr2sep
    False

    All three forms of attribute access define augmented exception messages
    in case anything goes wrong:

    >>> iswarm.north = True, True, True
    Traceback (most recent call last):
    ...
    ValueError: While trying to assign new values to parameter `iswarm` of \
element `?` via the row related attribute `north`, the following error \
occured: cannot copy sequence with size 3 to array axis with dimension 2
    >>> iswarm.apr2sep = True, True, True
    Traceback (most recent call last):
    ...
    ValueError: While trying to assign new values to parameter `iswarm` of \
element `?` via the column related attribute `apr2sep`, the following error \
occured: cannot copy sequence with size 3 to array axis with dimension 2

    >>> iswarm.shape = (1, 1)
    >>> iswarm.south_apr2sep = False
    Traceback (most recent call last):
    ...
    IndexError: While trying to assign new values to parameter `iswarm` of \
element `?` via the row and column related attribute `south_apr2sep`, the \
following error occured: index 1 is out of bounds for axis 0 with size 1
    >>> iswarm.shape = (2, 2)

    Of course, one can define the parameter values in the common manner, e.g.:

    >>> iswarm(True)
    >>> iswarm
    iswarm(north=[True, True],
           south=[True, True])

    For parameters with many columns, string representations are properly
    wrapped:

    >>> iswarm.shape = (2, 10)
    >>> iswarm
    iswarm(north=[False, False, False, False, False, False, False, False,
                  False, False],
           south=[False, False, False, False, False, False, False, False,
                  False, False])
    """
    NDIM = 2
    ROWNAMES = ()
    COLNAMES = ()

    def connect(self, subpars):
        MultiParameter.connect(self, subpars)
        self.shape = (len(self.ROWNAMES), len(self.COLNAMES))

    def __call__(self, *args, **kwargs):
        try:
            MultiParameter.__call__(self, *args, **kwargs)
        except NotImplementedError:
            for (idx, key) in enumerate(self.ROWNAMES):
                try:
                    values = kwargs[key]
                except KeyError:
                    miss = [key for key in self.ROWNAMES if key not in kwargs]
                    raise ValueError(
                        'When setting parameter `%s` of element `%s` via '
                        'row related keyword arguments, each string '
                        'defined in `ROWNAMES` must be used as a keyword, '
                        'but the following keyword%s not: `%s`.'
                        % (self.name, objecttools.devicename(self),
                           ' is' if len(miss) == 1 else 's are',
                           ', '.join(miss)))
                self.values[idx, :] = values

    def __repr__(self):
        lines = self.commentrepr()
        prefix = '%s(' % self.name
        blanks = ' '*len(prefix)
        for (idx, key) in enumerate(self.ROWNAMES):
            subprefix = ('%s%s=' % (prefix, key) if idx == 0 else
                         '%s%s=' % (blanks, key))
            lines.append(objecttools.assignrepr_list(self.values[idx, :],
                                                     subprefix, 75) + ',')
        lines[-1] = lines[-1][:-1] + ')'
        return '\n'.join(lines)

    def __getattr__(self, key):
        if key in self.ROWNAMES:
            try:
                return self.values[self.ROWNAMES.index(key), :]
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to retrieve values from parameter `%s` of '
                    'element `%s` via the row related attribute `%s`'
                    % (self.name, objecttools.devicename(self), key))
        elif key in self.COLNAMES:
            try:
                return self.values[:, self.COLNAMES.index(key)]
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to retrieve values from parameter `%s` of '
                    'element `%s` via the columnd related attribute `%s`'
                    % (self.name, objecttools.devicename(self), key))
        elif key in self._ROWCOLMAPPINGS:
            idx, jdx = self._ROWCOLMAPPINGS[key]
            try:
                return self.values[idx, jdx]
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to retrieve values from parameter `%s` of '
                    'element `%s` via the row and column related attribute '
                    '`%s`' % (self.name, objecttools.devicename(self), key))
        else:
            return MultiParameter.__getattr__(self, key)

    def __setattr__(self, key, values):
        if key in self.ROWNAMES:
            try:
                self.values[self.ROWNAMES.index(key), :] = values
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to assign new values to parameter `%s` of '
                    'element `%s` via the row related attribute `%s`'
                    % (self.name, objecttools.devicename(self), key))
        elif key in self.COLNAMES:
            try:
                self.values[:, self.COLNAMES.index(key)] = values
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to assign new values to parameter `%s` of '
                    'element `%s` via the column related attribute `%s`'
                    % (self.name, objecttools.devicename(self), key))
        elif key in self._ROWCOLMAPPINGS:
            idx, jdx = self._ROWCOLMAPPINGS[key]
            try:
                self.values[idx, jdx] = values
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to assign new values to parameter `%s` of '
                    'element `%s` via the row and column related attribute '
                    '`%s`' % (self.name, objecttools.devicename(self), key))
        else:
            MultiParameter.__setattr__(self, key, values)

    def __dir__(self):
        return (objecttools.dir_(self) + list(self.ROWNAMES) +
                list(self.COLNAMES) + list(self._ROWCOLMAPPINGS.keys()))


class LeftRightParameter(MultiParameter):
    NDIM = 1

    def __call__(self, *args, **kwargs):
        try:
            MultiParameter.__call__(self, *args, **kwargs)
        except NotImplementedError:
            left = kwargs.get('left', kwargs.get('l'))
            if left is None:
                raise ValueError('When setting the values of parameter `%s`'
                                 'of element `%s` via keyword arguments, '
                                 'either `left` or `l` for the "left" '
                                 'parameter value must be given, but is not.'
                                 % (self.name, objecttools.devicename(self)))
            else:
                self.left = left
            right = kwargs.get('right', kwargs.get('r'))
            if right is None:
                raise ValueError('When setting the values of parameter `%s`'
                                 'of element `%s` via keyword arguments, '
                                 'either `right` or `r` for the "right" '
                                 'parameter value must be given, but is not.'
                                 % (self.name, objecttools.devicename(self)))
            else:
                self.right = right

    def connect(self, subpars):
        MultiParameter.connect(self, subpars)
        self.shape = 2

    def _getleft(self):
        """The "left" value of the actual parameter."""
        return self.values[0]

    def _setleft(self, value):
        self.values[0] = value

    left = property(_getleft, _setleft)

    def _getright(self):
        """The "right" value of the actual parameter."""
        return self.values[1]

    def _setright(self, value):
        self.values[1] = value

    right = property(_getright, _setright)


class IndexParameter(MultiParameter):

    def setreference(self, indexarray):
        setattr(self.fastaccess, self.name, indexarray)


class SolverParameter(SingleParameter):

    def __init__(self):
        SingleParameter.__init__(self)
        self._alternative_initvalue = None

    def __call__(self, *args, **kwargs):
        SingleParameter.__call__(self, *args, **kwargs)
        self.alternative_initvalue = self.value

    def update(self):
        try:
            self(self.alternative_initvalue)
        except RuntimeError:
            self(self.modify_init())

    def modify_init(self):
        return self.INIT

    def _get_alternative_initvalue(self):
        if self._alternative_initvalue is None:
            raise RuntimeError(
                'No alternative initial value for solver parameter `%s` of '
                'element `%s` has been defined so far.'
                % (self.name, objecttools.devicename(self)))
        else:
            return self._alternative_initvalue

    def _set_alternative_initvalue(self, value):
        self._alternative_initvalue = value

    def _del_alternative_initvalue(self):
        self._alternative_initvalue = None

    alternative_initvalue = property(_get_alternative_initvalue,
                                     _set_alternative_initvalue,
                                     _del_alternative_initvalue)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/printtools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
# -*- coding: utf-8 -*-
"""This module implements features for printing additional information and
for modifying how information is printed."""
# import...
# ...from the Python standard library
from __future__ import division, print_function
import os
import sys
import tempfile
import time
# ...from site-packages
import wrapt
# ...from HydPy
from hydpy import pub
from hydpy.core import autodoctools
from hydpy.core import objecttools


class PrintStyle(object):
    """Context manager for changing the colour and font of printed
    output temporarilly."""

    def __init__(self, color, font, file=None):
        self.color = color
        self.font = font
        self.file = sys.stdout if file is None else file

    def __enter__(self):
        if pub.options.printincolor:
            print(end='\x1B[%d;30;%dm' % (self.font, self.color),
                  file=self.file)

    def __exit__(self, exception, message, traceback_):
        if pub.options.printincolor:
            print(end='\x1B[0m', file=self.file)
        if exception:
            objecttools.augment_excmessage()


@wrapt.decorator
def print_progress(wrapped, instance, args, kwargs):
    """Decorate a function with printing information when its execution
    starts and ends."""
    pub._printprogress_indentation += 4
    blanks = ' ' * pub._printprogress_indentation
    try:
        if pub.options.printprogress:
            with PrintStyle(color=34, font=1):
                print('\n%smethod %s...'
                      % (blanks, wrapped.__name__))
                print('%s    ...started at %s.'
                      % (' '*pub._printprogress_indentation,
                         time.strftime('%X')))
            sys.stdout.flush()
        wrapped(*args, **kwargs)
        if pub.options.printprogress:
            with PrintStyle(color=34, font=1):
                print('%s    ...ended at %s.'
                      % (blanks, time.strftime('%X')))
            sys.stdout.flush()
    finally:
        pub._printprogress_indentation -= 4


def progressbar(iterable, length=23):
    """Print a simple progress bar while processing the given iterable.

    Function |progressbar| does print the progress bar when option
    `printprogress` is activted:

    >>> from hydpy import pub
    >>> pub.options.printprogress = True

    You can pass an iterable object.  Say you want to calculate the the sum
    of all integer values from 1 to 100 and print the progress of the
    calculation.  Using function |range| (which returns a list in Python 2
    and an iterator in Python3, but both are fine), one just has to
    interpose function |progressbar|:

    >>> from hydpy.core.printtools import progressbar
    >>> x_sum = 0
    >>> for x in progressbar(range(1, 101)):
    ...     x_sum += x
        |---------------------|
        ***********************
    >>> x_sum
    5050

    To prevent possible interim print commands from dismembering the status
    bar, they are delayed until the status bar is complete.  For intermediate
    print outs of each fiftieth calculation, the result looks as follows:

    >>> x_sum = 0
    >>> for x in progressbar(range(1, 101)):
    ...     x_sum += x
    ...     if not x % 50:
    ...         print(x, x_sum)
        |---------------------|
        ***********************
    50 1275
    100 5050


    The number of characters of the progress bar can be changed:

    >>> for i in progressbar(range(100), length=50):
    ...     continue
        |------------------------------------------------|
        **************************************************

    But its maximum number of characters is restricted by the length of the
    given iterable:

    >>> for i in progressbar(range(10), length=50):
    ...     continue
        |--------|
        **********

    The smallest possible progress bar has two characters:

    >>> for i in progressbar(range(2)):
    ...     continue
        ||
        **

    For iterables of length one or zero, no progress bar is plottet:


    >>> for i in progressbar(range(1)):
    ...     continue


    The same is True when the `printprogress` option is inactivated:

    >>> pub.options.printprogress = False
    >>> for i in progressbar(range(100)):
    ...     continue
    """
    if pub.options.printprogress and (len(iterable) > 1):
        temp_name = os.path.join(tempfile.gettempdir(),
                                 'HydPy_progressbar_stdout')
        temp_stdout = open(temp_name, 'w')
        real_stdout = sys.stdout
        try:
            sys.stdout = temp_stdout
            nmbstars = min(len(iterable), length)
            nmbcounts = len(iterable)/nmbstars
            indentation = ' '*max(pub._printprogress_indentation, 0)
            with PrintStyle(color=36, font=1, file=real_stdout):
                print('    %s|%s|\n%s    ' % (indentation,
                                              '-'*(nmbstars-2),
                                              indentation),
                      end='',
                      file=real_stdout)
                counts = 1.
                for next_ in iterable:
                    counts += 1.
                    if counts >= nmbcounts:
                        print(end='*', file=real_stdout)
                        counts -= nmbcounts
                    yield next_
        finally:
            try:
                temp_stdout.close()
            except BaseException:
                pass
            sys.stdout = real_stdout
            print()
            with open(temp_name, 'r') as temp_stdout:
                sys.stdout.write(temp_stdout.read())
            sys.stdout.flush()
    else:
        for next_ in iterable:
            yield next_


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/selectiontools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
# -*- coding: utf-8 -*-
"""This module implements tools for selecting certain models in large
HydPy projects.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import os
# ...from HydPy
from hydpy import pub
from hydpy.core import objecttools
from hydpy.core import devicetools
from hydpy.core import autodoctools


class Selections(object):
    """Collects |Selection| instances.

    Attributes:
        * ? (|Selection|): An arbitrary number of |Selection| objects,
          which can be added (and removed) on demand.  Choose attribute
          names that are meaningfull within your specific project.
    """

    def __init__(self, *selections):
        for selection in selections:
            self += selection

    @property
    def names(self):
        """Names of the actual selections."""
        return tuple(vars(self).keys())

    def save(self, path='', write_nodes=False):
        """Save all selections in separate network files."""
        for selection in self:
            fullpath = os.path.join(path, selection.name+'.py')
            selection.save(fullpath, write_nodes)

    def _getselections(self):
        """The actual selections themselves."""
        return tuple(vars(self).values())

    selections = property(_getselections)

    def __setitem__(self, key, value):
        self.__dict__[key] = value

    def __getitem__(self, key):
        return self.__dict__[key]

    def __delitem__(self, key):
        del(self.__dict__[key])

    def __contains__(self, value):
        if isinstance(value, Selection):
            return value in self.selections
        else:
            return value in self.names

    def __iter__(self):
        for (name, selection) in sorted(vars(self).items()):
            yield selection

    def __len__(self):
        return len(self.names)

    @staticmethod
    def _getiterable(value):
        """Tries to convert the given argument to a |list| of |Selection|
        objects and returns it.

        Argument:
            * value (|Selection|, |Selections| of a simple
              iterable containing |Selection| objects): The second
              operand applied in an arithmetic operation.
        """
        if isinstance(value, Selection):
            return [value]
        elif isinstance(value, Selections):
            return value.selections
        else:
            try:
                for selection in value:
                    selection.name
                    break
                return list(value)
            except (KeyError, AttributeError):
                raise TypeError('Arithmetic operations on `Selections` '
                                'objects are defined for other `Selections` '
                                'objects, single `Selection` objects or '
                                'simple iterables (like `list` objects) '
                                'containing `Selection` objects only.  The '
                                'given arguments type is `%s`.'
                                % type(value))

    def __add__(self, value):
        selections = self._getiterable(value)
        new = self.copy()
        for selection in selections:
            new[selection.name] = selection
        return new

    def __iadd__(self, value):
        selections = self._getiterable(value)
        for selection in selections:
            self[selection.name] = selection
        return self

    def __sub__(self, value):
        selections = self._getiterable(value)
        new = self.copy()
        for selection in selections:
            try:
                del(new[selection.name])
            except KeyError:
                pass
        return new

    def __isub__(self, value):
        selections = self._getiterable(value)
        for selection in selections:
            try:
                del(self[selection.name])
            except KeyError:
                pass
        return self

    def __repr__(self):
        return self.assignrepr('')

    def assignrepr(self, prefix):
        """Return a |repr| string with an prefixed assignement.

        Argument:
            * prefix(|str|): Usually something like 'x = '.
        """
        with objecttools.repr_.preserve_strings(True):
            with pub.options.ellipsis(2, optional=True):
                prefix += '%s(' % objecttools.classname(self)
                repr_ = objecttools.assignrepr_values(self.names, prefix, 70)
                return repr_ + ')'

    def __dir__(self):
        return ['names', 'selections', 'assignrepr'] + list(self.names)


class Selection(object):
    """Defines a combination of |Node| and |Element| objects suitable for a
    specific task.

    Attributes:
        * name (|str|): Name of the selection.
        * nodes (|Nodes|): Currently selected nodes.
        * elements (|Elements|): Currently selected elements.
    """

    def __init__(self, name, nodes=None, elements=None):
        self.name = name
        self.nodes = devicetools.Nodes(nodes)
        self.elements = devicetools.Elements(elements)

    def select_upstream(self, device):
        """Limit the current selection to the network upstream of the given
        starting point, including the starting point itself.

        Argument:
            * device (|Node| or |Element|): Lowest point to be selected.
        """
        self.nodes, self.elements = self.getby_upstream(device)
        return self

    def deselect_upstream(self, device):
        """Remove the network upstream of the given starting point from the
        current selection, including the starting point itself.

        Argument:
            * device (|Node| or |Element|): Highest point to be deselected.
        """
        nodes, elements = self.getby_upstream(device)
        self.nodes -= nodes
        self.elements -= elements
        return self

    def getby_upstream(self, device):
        """Returns the network upstream of the given starting point, including
        the starting point itself.

        Argument:
            * device (|Node| or |Element|): Lowest point to be selected.
        """
        nodes = devicetools.Nodes()
        elements = devicetools.Elements()
        if isinstance(device, devicetools.Node):
            nodes, elements = self._nextnode(device, nodes, elements)
        elif isinstance(device, devicetools.Element):
            nodes, elements = self._nextelement(device, nodes, elements)
        else:
            raise AttributeError('Pass either a `Node` or an `Element` '
                                 'instance to the function.  The given '
                                 '`device` value `%s` is of type `%s`.'
                                 % (device, type(device)))
        return nodes, elements

    def _nextnode(self, node, nodes, elements):
        """First recursion method for |Selection.getupstreamnetwork|.

        Arguments:
            * node (|Node|): The node which is selected currently.
            * nodes (|Nodes|): All nodes which have been selected so far.
            * elements (|Elements|): All elements which have been selected
              so far.
        """
        if (node not in nodes) and (node in self.nodes):
            nodes += node
            for element in node.entries:
                nodes, elements = self._nextelement(element, nodes, elements)
        return nodes, elements

    def _nextelement(self, element, nodes, elements):
        """Second recursion method for |Selection.getupstreamnetwork|.

        Arguments:
            * element (|Element|): The element which is selected currently.
            * nodes (|Nodes|): All nodes which have been selected so far.
            * elements (|Element|): All elements which have been selected
              so far.
        """
        if (element not in elements) and (element in self.elements):
            elements += element
            for node in element.inlets:
                nodes, elements = self._nextnode(node, nodes, elements)
        return nodes, elements

    def select_modelclasses(self, *modelclass):
        """Limits the current selection to all elements containing the
        given modelclass(es).  (All nodes are removed.)

        Argument:
            * modelclass (subclass of |Model|): Model type(s) as the
              selection criterion/criteria.
        """
        self.nodes = devicetools.Nodes()
        self.elements = self.getby_modelclasses(modelclass)
        return self

    def deselect_modelclasses(self, *modelclasses):
        """Limits the current selection to all elements not containing the
        given modelclass(es).  (All nodes are removed.)

        Argument:
            * modelclass (subclass of |Model|): Model type(s) as the
              selection criterion/criteria.
        """
        self.nodes = devicetools.Nodes()
        self.elements -= self.getby_modelclasses(*modelclasses)
        return self

    def getby_modelclasses(self, *modelclasses):
        """Returns all elements of the current selection containing the given
        modelclass(es).

        Argument:
            * modelclass (subclass of |Model|): Model type(s) as the
              selection criterion/criteria.
        """
        elements = devicetools.Elements()
        for element in self.elements:
            if element.model is None:
                raise RuntimeError('For element `%s` no model object has been '
                                   'initialized so far, which is a necessary '
                                   'condition to perform (de)selections based '
                                   'on model classes.' % element)
            if isinstance(element.model, modelclasses):
                elements += element
        return elements

    def select_nodenames(self, *substrings):
        """Limits the current selection to all nodes with a name
        containing the given substring(s).  (All elements are unaffected.)

        Argument:
            * substrings (|str|): (Possible) Part(s) of the nodes
              name as the selection criterion/criteria.
        """
        self.nodes = self.getby_nodenames(*substrings)
        return self

    def deselect_nodenames(self, *substrings):
        """Limits the current selection to all nodes with a name
        not containing the given substring(s).  (All elements are unaffected.)

        Argument:
            * substrings (|str|): (Possible) Part(s) of the nodes
              name as the selection criterion/criteria.
        """
        self.nodes -= self.getby_nodenames(*substrings)
        return self

    def getby_nodenames(self, *substrings):
        """Returns all nodes of the current selection with a name
        containing the given substrings(s).

        Argument:
            * substrings (|str|): (Possible) Part(s) of the nodes
              name as the selection criterion/criteria.
        """
        nodes = devicetools.Nodes()
        for node in self.nodes:
            for substring in substrings:
                if substring in node.name:
                    nodes += node
                    break
        return nodes

    def select_elementnames(self, *substrings):
        """Limits the current selection to all elements with a name
        containing the given substring(s).  (All nodes are unaffected.)

        Argument:
            * substrings (|str|): (Possible) Part(s) of the elements
              name as the selection criterion/criteria.
        """
        self.elements = self.getby_elementnames(*substrings)
        return self

    def deselect_elementnames(self, *substrings):
        """Limits the current selection to all elements with a name
        not containing the given substring(s).  (All nodes are unaffected.)

        Argument:
            * substrings (|str|): (Possible) Part(s) of the elements
              name as the selection criterion/criteria.
        """
        self.elements -= self.getby_elementnames(*substrings)
        return self

    def getby_elementnames(self, *substrings):
        """Returns all elements of the current selection with a name
        containing the given substrings(s).

        Argument:
            * substrings (|str|): (Possible) Part(s) of the elements
              name as the selection criterion/criteria.
        """
        elements = devicetools.Elements()
        for element in self.elements:
            for substring in substrings:
                if substring in element.name:
                    elements += element
                    break
        return elements

    def copy(self, name):
        """Returns a semi-deep copy of the current selection.

        Arguments:
            * name (|str|): Name of the new |Selection| instance.
        """
        return Selection(name, self.nodes.copy(), self.elements.copy())

    def save(self, path=None, write_nodes=False):
        """Save the selection as a network file."""
        if path is None:
            path = self.name + '.py'
        with open(path, 'w', encoding="utf-8") as file_:
            file_.write('# -*- coding: utf-8 -*-\n')
            file_.write('\nfrom hydpy import Node, Element\n\n')
            if write_nodes:
                for node in self.nodes:
                    file_.write('\n' + repr(node) + '\n')
                file_.write('\n')
            for element in self.elements:
                file_.write('\n' + repr(element) + '\n')

    def __len__(self):
        return len(self.nodes) + len(self.elements)

    def __iadd__(self, other):
        self.nodes += other.nodes
        self.elements += other.elements
        return self

    def __isub__(self, other):
        self.nodes -= other.nodes
        self.elements -= other.elements
        return self

    def __lt__(self, other):
        return ((self.nodes < other.nodes) and
                (self.elements < other.elements))

    def __le__(self, other):
        return ((self.nodes <= other.nodes) and
                (self.elements <= other.elements))

    def __eq__(self, other):
        return ((self.nodes == other.nodes) and
                (self.elements == other.elements))

    def __ne__(self, other):
        return ((self.nodes != other.nodes) or
                (self.elements != other.elements))

    def __ge__(self, other):
        return ((self.nodes >= other.nodes) and
                (self.elements >= other.elements))

    def __gt__(self, other):
        return ((self.nodes > other.nodes) and
                (self.elements >= other.elements))

    def __str__(self):
        return self.name

    def __repr__(self):
        return self.assignrepr('')

    def assignrepr(self, prefix):
        """Return a |repr| string with an prefixed assignement.

        Argument:
            * prefix(|str|): Usually something like 'x = '.
        """
        with objecttools.repr_.preserve_strings(True):
            with pub.options.ellipsis(2, optional=True):
                with objecttools.assignrepr_tuple.always_bracketed(False):
                    prefix = '%sSelection(' % prefix
                    blanks = ' ' * len(prefix)
                    lines = ['%s"%s",' % (prefix, self.name)]
                    lines.append(objecttools.assignrepr_tuple(
                            self.elements.names, blanks+'elements=', 70) + ',')
                    lines.append(objecttools.assignrepr_tuple(
                            self.nodes.names, blanks+'nodes=', 70) + ')')
                    return '\n'.join(lines)

    def __dir__(self):
        return ['copy', 'deselect_elementnames', 'deselect_modelclasses',
                'deselect_nodenames', 'deselect_upstream', 'elements',
                'getby_elementnames', 'getby_modelclasses', 'getby_nodenames',
                'getby_upstream', 'nodes', 'select_elementnames',
                'select_modelclasses', 'select_nodenames', 'select_upstream',
                'assignrepr']


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/sequencetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
# -*- coding: utf-8 -*-
"""This module implements tools for handling the sequences (time series)
of hydrological models.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import os
import sys
import copy
import struct
import warnings
# ...from site-packages
import numpy
# ...from HydPy
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import objecttools
from hydpy.core import timetools
from hydpy.core import variabletools
from hydpy.cythons.autogen import pointerutils


class Sequences(object):
    """Handles all sequences of a specific model."""

    _names_subseqs = ('inlets', 'receivers', 'inputs', 'fluxes', 'states',
                      'logs', 'aides', 'outlets', 'senders')

    def __init__(self, **kwargs):
        self.model = kwargs.pop('model', None)
        cythonmodule = kwargs.pop('cythonmodule', None)
        cymodel = kwargs.pop('cymodel', None)
        for (name, cls) in kwargs.items():
            if name.endswith('Sequences') and issubclass(cls, SubSequences):
                if cythonmodule:
                    cls_fastaccess = getattr(cythonmodule, name)
                    subseqs = cls(self, cls_fastaccess, cymodel)
                else:
                    subseqs = cls(self, None, None)
                setattr(self, subseqs.name, subseqs)

    def _yield_iosubsequences(self):
        for subseqs in self:
            if isinstance(subseqs, abctools.IOSequencesABC):
                yield subseqs

    def activate_disk(self, names=None):
        """Call method |IOSequences.activate_disk| of all handled
        |IOSequences| objects."""
        for subseqs in self._yield_iosubsequences():
            subseqs.activate_disk(names)

    def deactivate_disk(self, names=None):
        """Call method |IOSequences.deactivate_disk| of all handled
        |IOSequences| objects."""
        for subseqs in self._yield_iosubsequences():
            subseqs.deactivate_disk(names)

    def activate_ram(self, names=None):
        """Call method |IOSequences.activate_ram| of all handled
        |IOSequences| objects."""
        for subseqs in self._yield_iosubsequences():
            subseqs.activate_ram(names)

    def deactivate_ram(self, names=None):
        """Call method |IOSequences.deactivate_ram| of all handled
        |IOSequences| objects."""
        for subseqs in self._yield_iosubsequences():
            subseqs.deactivate_ram(names)

    def open_files(self, idx=0):
        """Call method |IOSequences.open_files| of all handled
        |IOSequences| objects."""
        for subseqs in self._yield_iosubsequences():
            subseqs.open_files(idx)

    def close_files(self):
        """Call method |IOSequences.close_files| of all handled
        |IOSequences| objects."""
        for subseqs in self._yield_iosubsequences():
            subseqs.close_files()

    def load_data(self, idx):
        """Call method |InputSequences.load_data| of all handled
        |InputSequences| objects."""
        for subseqs in self:
            if isinstance(subseqs, abctools.InputSequencesABC):
                subseqs.load_data(idx)

    def save_data(self, idx):
        """Call method `save_data|` of all handled |IOSequences|
        objects registered under |OutputSequencesABC|."""
        for subseqs in self:
            if isinstance(subseqs, abctools.OutputSequencesABC):
                subseqs.save_data(idx)

    def reset(self):
        """Call method |ConditionSequence.reset| of all handled
        |ConditionSequence| objects."""
        for subseqs in self:
            if isinstance(subseqs, abctools.ConditionSequenceABC):
                subseqs.reset()

    def __iter__(self):
        for name in self._names_subseqs:
            subseqs = getattr(self, name, None)
            if subseqs is not None:
                yield subseqs

    @property
    def conditions(self):
        """Generator object yielding all conditions (|StateSequence| and
        |LogSequence| objects).
        """
        for subseqs in ('states', 'logs'):
            for tuple_ in getattr(self, subseqs, ()):
                yield tuple_

    @property
    def hasconditions(self):
        """True or False, whether the |Sequences| object "handles conditions"
        or not (at least one |StateSequence| or |LogSequence| object)."""
        for dummy in self.conditions:
            return True
        return False

    @property
    def _conditiondefaultfilename(self):
        filename = objecttools.devicename(self)
        if filename == '?':
            raise RuntimeError(
                'To load or save the conditions of a model from or to a file, '
                'its filename must be known.  This can be done, by passing '
                'filename to method `load_conditions` or `save_conditions` '
                'directly.  But in complete HydPy applications, it is usally '
                'assumed to be consistent with the name of the element '
                'handling the model.  Actually, neither a filename is given '
                'nor does the model know its master element.')
        else:
            return filename + '.py'

    def load_conditions(self, filename=None):
        """Read the initial conditions from a file and assign them to the
        respective |StateSequence| and/or |LogSequence| objects handled by
        the actual |Sequences| object.

        If no filename or dirname is passed, the ones defined by the
        |ConditionManager| stored in module |pub| are used.
        """
        if self.hasconditions:
            if not filename:
                filename = self._conditiondefaultfilename
            namespace = locals()
            for seq in self.conditions:
                namespace[seq.name] = seq
            namespace['model'] = self
            code = pub.conditionmanager.load_file(filename)
            try:
                exec(code)
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to gather initial conditions of element %s'
                    % objecttools.devicename(self))

    def save_conditions(self, filename=None):
        """Query the actual conditions of the |StateSequence| and/or
        |LogSequence| objects handled by the actual |Sequences| object and
        write them into a initial condition file.

        If no filename or dirname is passed, the ones defined by the
        |ConditionManager| stored in module |pub| are used.
        """
        if self.hasconditions:
            if filename is None:
                filename = self._conditiondefaultfilename
            con = pub.controlmanager
            lines = ['# -*- coding: utf-8 -*-\n\n',
                     'from hydpy.models.%s import *\n\n' % self.model,
                     'controlcheck(projectdir="%s", controldir="%s")\n\n'
                     % (con.projectdir, con.currentdir)]
            for seq in self.conditions:
                lines.append(repr(seq) + '\n')
            pub.conditionmanager.save_file(filename, ''.join(lines))

    def trim_conditions(self):
        """Call method |trim| of each handled |ConditionSequence|."""
        for seq in self.conditions:
            seq.trim()

    def __len__(self):
        return len(dict(self))


class _MetaSubSequencesType(type):
    def __new__(mcs, name, parents, dict_):
        seqclasses = dict_.get('_SEQCLASSES')
        if seqclasses is None:
            raise NotImplementedError(
                'For class `%s`, the required tuple `_SEQCLASSES` is not '
                'defined.  Please see the documentation of class '
                '`SubSequences` of module `sequencetools` for further '
                'information.' % name)
        if seqclasses:
            lst = ['\n\n\n    The following sequence classes are selected:']
            for seqclass in seqclasses:
                lst.append('      * :class:`~%s` %s'
                           % ('.'.join((seqclass.__module__,
                                        seqclass.__name__)),
                              autodoctools.description(seqclass)))
            doc = dict_.get('__doc__', None)
            if doc is None:
                doc = ''
            dict_['__doc__'] = doc + '\n'.join(l for l in lst)
        return type.__new__(mcs, name, parents, dict_)


_MetaSubSequencesClass = _MetaSubSequencesType('_MetaSubSequencesClass',
                                               (), {'_SEQCLASSES': ()})


class SubSequences(_MetaSubSequencesClass):
    """Base class for handling subgroups of sequences.

    Attributes:
      * seqs: The parent |Sequences| object.
      * fastaccess: The  |sequencetools.FastAccess| object allowing fast
        access to the sequence values. In `Cython` mode, model specific
        cdef classes are applied.

    Additional attributes are the actual |Sequence| instances, representing
    the individual time series.  These need to be defined in
    |SubSequences| subclasses.  Therefore, one needs to collect the
    appropriate |Sequence| subclasses in the (hidden) class attribute
    `_SEQCLASSES`, as shown in the following example:

    >>> from hydpy.core.sequencetools import *
    >>> class Temperature(Sequence):
    ...    NDIM, NUMERIC = 0, False
    >>> class Precipitation(Sequence):
    ...    NDIM, NUMERIC = 0, True
    >>> class InputSequences(SubSequences):
    ...     _SEQCLASSES = (Temperature, Precipitation)
    >>> inputs = InputSequences(None) # Assign `None` for brevity.
    >>> inputs
    temperature(nan)
    precipitation(nan)

    The order within the tuple determines the order of iteration, hence:

    >>> for sequence in inputs:
    ...     print(sequence)
    temperature(nan)
    precipitation(nan)

    If one forgets to define a `_SEQCLASSES` tuple so (and maybe tries to
    add the sequences in the constructor of the subclass of |SubSequences|,
    the following error is raised:

    >>> class InputSequences(SubSequences):
    ...     pass
    Traceback (most recent call last):
    ...
    NotImplementedError: For class `InputSequences`, the required tuple \
`_SEQCLASSES` is not defined.  Please see the documentation of class \
`SubSequences` of module `sequencetools` for further information.

    """
    _SEQCLASSES = ()

    def __init__(self, seqs, cls_fastaccess=None, cymodel=None):
        self.seqs = seqs
        self._initfastaccess(cls_fastaccess, cymodel)
        self._initsequences()

    def _initfastaccess(self, cls_fastaccess, cymodel):
        if cls_fastaccess is None:
            self.fastaccess = FastAccess()
        else:
            self.fastaccess = cls_fastaccess()
            setattr(cymodel.sequences, self.name, self.fastaccess)

    def _initsequences(self):
        for cls_seq in self._SEQCLASSES:
            setattr(self, objecttools.instancename(cls_seq), cls_seq())

    @classmethod
    def getname(cls):
        return objecttools.instancename(cls)[:-8]

    @property
    def name(self):
        return self.getname()

    def __setattr__(self, name, value):
        """Attributes and methods should usually not be replaced.  Existing
        |Sequence| attributes are protected in a way, that only their
        values are changed through assignements.  For new |Sequence|
        attributes, additional `fastaccess` references are defined.  If you
        actually want to replace a sequence, you have to delete it first.
        """
        try:
            attr = getattr(self, name)
        except AttributeError:
            object.__setattr__(self, name, value)
            if isinstance(value, Sequence):
                value.connect(self)
        else:
            try:
                attr.values = value
            except AttributeError:
                raise RuntimeError(
                    '`%s` instances do not allow the direct replacement of '
                    'their members.  After initialization you should usually '
                    'only change parameter values through assignements.  '
                    'If you really need to replace a object member, delete '
                    'it beforehand.'
                    % objecttools.classname(self))

    def __iter__(self):
        for seqclass in self._SEQCLASSES:
            name = objecttools.instancename(seqclass)
            yield getattr(self, name)

    def __getitem__(self, key):
        return self.__dict__[key]

    def __repr__(self):
        lines = []
        if pub.options.reprcomments:
            lines.append('#%s object defined in module %s.'
                         % (objecttools.classname(self),
                            objecttools.modulename(self)))
            lines.append('#The implemented sequences with their actual '
                         'values are:')
        for sequence in self:
            try:
                lines.append('%s' % repr(sequence))
            except BaseException:
                lines.append('%s(?)' % sequence.name)
        return '\n'.join(lines)

    def __dir__(self):
        return objecttools.dir_(self)


class IOSequences(SubSequences):
    _SEQCLASSES = ()

    def open_files(self, idx=0):
        self.fastaccess.open_files(idx)

    def close_files(self):
        self.fastaccess.close_files()

    def activate_ram(self):
        for seq in self:
            seq.activate_ram()

    def deactivate_ram(self):
        for seq in self:
            seq.deactivate_ram()

    def activate_disk(self):
        for seq in self:
            seq.activate_disk()

    def deactivate_disk(self):
        for seq in self:
            seq.deactivate_disk()

    def ram2disk(self):
        for seq in self:
            seq.ram2disk()

    def disk2ram(self):
        for seq in self:
            seq.disk2ram()


abctools.IOSequencesABC.register(IOSequences)


class InputSequences(IOSequences):
    """Base class for handling input sequences."""
    _SEQCLASSES = ()

    def load_data(self, idx):
        self.fastaccess.load_data(idx)


abctools.InputSequencesABC.register(InputSequences)


class FluxSequences(IOSequences):
    """Base class for handling flux sequences."""
    _SEQCLASSES = ()

    @classmethod
    def getname(cls):
        return 'fluxes'

    def save_data(self, idx):
        self.fastaccess.save_data(idx)

    @property
    def numerics(self):
        """Iterator for `numerical` flux sequences.

        `numerical` means that the `NUMERIC` class attribute of the
        respective sequence is `True`.
        """
        for flux in self:
            if flux.NUMERIC:
                yield flux


abctools.OutputSequencesABC.register(FluxSequences)


class StateSequences(IOSequences):
    """Base class for handling state sequences."""
    _SEQCLASSES = ()

    def _initfastaccess(self, cls_fastaccess, cymodel):
        IOSequences._initfastaccess(self, cls_fastaccess, cymodel)
        self.fastaccess_new = self.fastaccess
        if cls_fastaccess is None:
            self.fastaccess_old = FastAccess()
        else:
            setattr(cymodel.sequences, 'new_states', self.fastaccess)
            self.fastaccess_old = cls_fastaccess()
            setattr(cymodel.sequences, 'old_states', self.fastaccess_old)

    def new2old(self):
        """Assign the new/final state values of the actual time step to the
        new/initial state values of the next time step.
        """
        for seq in self:
            seq.new2old()

    def save_data(self, idx):
        self.fastaccess.save_data(idx)

    def reset(self):
        for seq in self:
            seq.reset()


abctools.OutputSequencesABC.register(StateSequences)


class LogSequences(SubSequences):
    """Base class for handling log sequences."""
    _SEQCLASSES = ()

    def reset(self):
        for seq in self:
            seq.reset()


class AideSequences(SubSequences):
    """Base class for handling aide sequences."""
    _SEQCLASSES = ()


class LinkSequences(SubSequences):
    """Base class for handling link sequences."""
    _SEQCLASSES = ()


class Sequence(variabletools.Variable):
    """Base class for defining different kinds of sequences."""

    NDIM, NUMERIC = 0, False

    NOT_DEEPCOPYABLE_MEMBERS = ('subseqs', 'fastaccess')

    def __init__(self):
        self.subseqs = None
        self.fastaccess = objecttools.FastAccess()

    def connect(self, subseqs):
        self.subseqs = subseqs
        self.fastaccess = subseqs.fastaccess
        self._connect_subattr('ndim', self.NDIM)
        self._connect_subattr('length', 0)
        for idx in range(self.NDIM):
            self._connect_subattr('length_%d' % idx, 0)
        self.diskflag = False
        self.ramflag = False
        try:
            self._connect_subattr('file', '')
        except AttributeError:
            pass
        self._initvalues()

    def _connect_subattr(self, suffix, value):
        setattr(self.fastaccess, '_%s_%s' % (self.name, suffix), value)

    def __call__(self, *args):
        """The prefered way to pass values to |Sequence| instances
        within initial condition files.
        """
        self.values = args

    @property
    def initvalue(self):
        if pub.options.usedefaultvalues:
            initvalue = getattr(self, 'INIT', None)
            if initvalue is None:
                initvalue = 0.
        else:
            initvalue = numpy.nan
        return initvalue

    def _initvalues(self):
        value = None if self.NDIM else self.initvalue
        setattr(self.fastaccess, self.name, value)

    def _getvalue(self):
        """The actual time series value(s) handled by the respective
        |Sequence| instance.  For consistency, `value` and `values`
        can always be used interchangeably.
        """
        value = getattr(self.fastaccess, self.name, None)
        if value is None:
            raise RuntimeError(
                'No value/values of sequence %s of element '
                '%s has/have been defined so far.'
                % (self.name, objecttools.devicename(self)))
        else:
            if self.NDIM:
                value = numpy.asarray(value)
            return value

    def _setvalue(self, value):
        if self.NDIM == 0:
            try:
                temp = value[0]
                if len(value) > 1:
                    raise ValueError(
                        '%d values are assigned to the scalar sequence %s '
                        'of element %s, which is ambiguous.'
                        % (len(value),
                           objecttools.devicename(self),
                           self.name))
                value = temp
            except (TypeError, IndexError):
                pass
            try:
                value = float(value)
            except (ValueError, TypeError):
                raise TypeError(
                    'When trying to set the value of sequence %s of element '
                    '%s, it was not possible to convert value `%s` to float.'
                    % (self.name, objecttools.devicename(self), value))
        else:
            try:
                value = value.value
            except AttributeError:
                pass
            try:
                value = numpy.full(self.shape, value, dtype=float)
            except ValueError:
                raise ValueError(
                    'For sequence %s of element %s setting new values failed. '
                    ' The values `%s` cannot be converted to a numpy ndarray '
                    'with shape %s containing entries of type float.'
                    % (self.name, objecttools.devicename(self),
                       value, self.shape))
        setattr(self.fastaccess, self.name, value)

    value = property(_getvalue, _setvalue)
    values = property(_getvalue, _setvalue)

    def _getshape(self):
        """A tuple containing the lengths in all dimensions of the sequence
        values at a specific time point.  Note that setting a new shape
        results in a loss of the actual values of the respective sequence.
        For 0-dimensional sequences an empty tuple is returned.
        """
        if self.NDIM:
            try:
                shape = self.values.shape
                return tuple(int(x) for x in shape)
            except AttributeError:
                raise RuntimeError(
                    'Shape information for sequence %s of element %s can '
                    'only be retrieved after it has been defined.'
                    % (self.name, objecttools.devicename(self)))
        else:
            return ()

    def _setshape(self, shape):
        if self.NDIM:
            try:
                array = numpy.full(shape, self.initvalue, dtype=float)
            except BaseException:
                prefix = ('While trying create a new numpy ndarray` for '
                          'sequence %s of element %s'
                          % (self.name, objecttools.devicename(self)))
                objecttools.augment_excmessage(prefix)
            if array.ndim == self.NDIM:
                setattr(self.fastaccess, self.name, array)
            else:
                raise ValueError(
                    'Sequence %s of element %s is %d-dimensional '
                    'but the given shape indicates %d dimensions.'
                    % (self.name, objecttools.devicename(self),
                       self.NDIM, array.ndim))
        else:
            if shape:
                raise ValueError(
                    'The shape information of 0-dimensional sequences as %s '
                    'of element %s can only be `()`, but `%s` is given.'
                    % (self.name, objecttools.devicename(self), shape))
            else:
                self.value = 0.

    shape = property(_getshape, _setshape)

    def __getitem__(self, key):
        try:
            return self.values[key]
        except BaseException:
            self._raiseitemexception()

    def __setitem__(self, key, values):
        try:
            self.values[key] = values
        except BaseException:
            self._raiseitemexception()

    def _raiseitemexception(self):
        if self.values is None:
            raise RuntimeError(
                'Sequence `%s` has no values so far.'
                % self.name)
        else:
            objecttools.augment_excmessage(
                'While trying to item access the values of sequence `%s`'
                % self.name)

    def __repr__(self):
        islong = self.length > 255
        return variabletools.Variable.repr_(self, self.values, islong)

    def __dir__(self):
        return objecttools.dir_(self)


abctools.SequenceABC.register(Sequence)


class IOSequence(Sequence):
    """Base class for sequences with input/output functionalities."""

    def __init__(self):
        Sequence.__init__(self)
        self._rawfilename = None
        self._filetype_ext = None
        self._filename_ext = None
        self._dirpath_ext = None
        self._dirpath_int = None
        self._filepath_ext = None
        self._filepath_int = None

    def _getfiletype_ext(self):
        """Ending of the external data file."""
        if self._filetype_ext:
            return self._filetype_ext
        else:
            try:
                if isinstance(self, abctools.InputSequenceABC):
                    return pub.sequencemanager.inputfiletype
                elif isinstance(self, abctools.NodeSequenceABC):
                    return pub.sequencemanager.nodefiletype
                return pub.sequencemanager.outputfiletype
            except AttributeError:
                raise RuntimeError(
                    'For sequence %s of element %s the type of the '
                    'external data file cannot be determined.  '
                    'Either set it manually or embed the sequence '
                    'object into the HydPy framework in the common'
                    'manner to allow for an automatic determination.'
                    % (self.name, objecttools.devicename(self)))

    def _setfiletype_ext(self, name):
        self._filetype_ext = name

    def _delfiletype_ext(self):
        self._filetype_ext = None

    filetype_ext = property(
        _getfiletype_ext, _setfiletype_ext, _delfiletype_ext)

    def _getfilename_ext(self):
        """Complete filename of the external data file."""
        if self._filename_ext:
            return self._filename_ext
        return '.'.join((self.rawfilename, self.filetype_ext))

    def _setfilename_ext(self, name):
        self._filename_ext = name

    def _delfilename_ext(self):
        self._filename_ext = None

    filename_ext = property(
        _getfilename_ext, _setfilename_ext, _delfilename_ext)

    def _getfilename_int(self):
        """Complete filename of the internal data file."""
        return self.rawfilename + '.bin'

    filename_int = property(_getfilename_int)

    def _getdirpath_ext(self):
        """Absolute path of the directory of the external data file."""
        if self._dirpath_ext:
            return self._dirpath_ext
        else:
            try:
                if isinstance(self, InputSequence):
                    return pub.sequencemanager.inputpath
                elif isinstance(self, NodeSequence):
                    return pub.sequencemanager.nodepath
                return pub.sequencemanager.outputpath
            except AttributeError:
                raise RuntimeError(
                    'For sequence `%s` the directory of the external '
                    'data file cannot be determined.  Either set it '
                    'manually or embed the sequence object into the '
                    'HydPy framework in the common manner to allow '
                    'for an automatic determination.'
                    % self.name)

    def _setdirpath_ext(self, name):
        self._dirpath_ext = name

    def _deldirpath_ext(self):
        self._dirpath_ext = None

    dirpath_ext = property(
        _getdirpath_ext, _setdirpath_ext, _deldirpath_ext)

    def _getdirpath_int(self):
        """Absolute path of the directory of the internal data file."""
        if self._dirpath_int:
            return self._dirpath_int
        else:
            try:
                return pub.sequencemanager.temppath
            except AttributeError:
                raise RuntimeError(
                    'For sequence `%s` the directory of the internal '
                    'data file cannot be determined.  Either set it '
                    'manually or embed the sequence object into the '
                    'HydPy framework in the common manner to allow '
                    'for an automatic determination.'
                    % self.name)

    def _setdirpath_int(self, name):
        self._dirpath_int = name

    def _deldirpath_int(self):
        self._dirpath_int = None
    dirpath_int = property(
        _getdirpath_int, _setdirpath_int, _deldirpath_int)

    def _getfilepath_ext(self):
        """Absolute path to the external data file."""
        if self._filepath_ext:
            return self._filepath_ext
        return os.path.join(self.dirpath_ext, self.filename_ext)

    def _setfilepath_ext(self, name):
        self._filepath_ext = name

    def _delfilepath_ext(self):
        self._filepath_ext = None
    filepath_ext = property(
        _getfilepath_ext, _setfilepath_ext, _delfilepath_ext)

    def _getfilepath_int(self):
        """Absolute path to the internal data file."""
        if self._filepath_int:
            return self._filepath_int
        return os.path.join(self.dirpath_int, self.filename_int)

    def _setfilepath_int(self, name):
        self._filepath_int = name

    def _delfilepath_int(self):
        self._filepath_int = None

    filepath_int = property(
        _getfilepath_int, _setfilepath_int, _delfilepath_int)

    def update_fastaccess(self):
        """"""
        if self.diskflag:
            path = self.filepath_int
        else:
            path = None
        setattr(self.fastaccess, '_%s_path' % self.name, path)
        length = 1
        for idx in range(self.NDIM):
            length *= self.shape[idx]
            setattr(self.fastaccess, '_%s_length_%d' % (self.name, idx),
                    self.shape[idx])
        setattr(self.fastaccess, '_%s_length' % self.name, length)

    def _getdiskflag(self):
        diskflag = getattr(
            self.fastaccess, '_%s_diskflag' % self.name, None)
        if diskflag is not None:
            return diskflag
        else:
            raise RuntimeError(
                'The `diskflag` of sequence `%s` has not been set yet.'
                % self.name)

    def _setdiskflag(self, value):
        setattr(self.fastaccess, '_%s_diskflag' % self.name, bool(value))

    diskflag = property(_getdiskflag, _setdiskflag)

    def _getramflag(self):
        ramflag = getattr(self.fastaccess, '_%s_ramflag' % self.name, None)
        if ramflag is not None:
            return ramflag
        else:
            raise RuntimeError(
                'The `ramflag` of sequence `%s` has not been set yet.'
                % self.name)

    def _setramflag(self, value):
        setattr(self.fastaccess, '_%s_ramflag' % self.name, bool(value))

    ramflag = property(_getramflag, _setramflag)

    def _getmemoryflag(self):
        return self.ramflag or self.diskflag

    memoryflag = property(_getmemoryflag)

    def _getarray(self):
        array = getattr(self.fastaccess, '_%s_array' % self.name, None)
        if array is not None:
            return numpy.asarray(array)
        else:
            raise RuntimeError(
                'The `ram array` of sequence `%s` has not been set yet.'
                % self.name)

    def _setarray(self, values):
        values = numpy.array(values, dtype=float)
        setattr(self.fastaccess, '_%s_array' % self.name, values)

    @property
    def seriesshape(self):
        """Shape of the whole time series (time being the first dimension)."""
        seriesshape = [len(pub.timegrids.init)]
        seriesshape.extend(self.shape)
        return tuple(seriesshape)

    @property
    def numericshape(self):
        """Shape of the array of temporary values required for the numerical
        solver actually being selected."""
        try:
            numericshape = [self.subseqs.seqs.model.numconsts.nmb_stages]
        except AttributeError:
            objecttools.augment_excmessage(
                'The `numericshape` of a sequence like `%s` depends on the '
                'configuration of the actual integration algorithm.  '
                'While trying to query the required configuration data '
                '`nmb_stages` of the model associated with element `%s`'
                % (self.name, objecttools.devicename(self)))
        numericshape.extend(self.shape)
        return tuple(numericshape)

    def _getseries(self):
        if self.diskflag:
            return self._load_int()
        elif self.ramflag:
            return self._getarray()
        else:
            raise RuntimeError(
                'Sequence `%s` of device `%s`is not requested '
                'to make any internal data available to the user.'
                % (self.name, objecttools.devicename(self)))

    def _setseries(self, values):
        series = self.series
        series[:] = values
        if self.diskflag:
            self._save_int(series)
        elif self.ramflag:
            self._setarray(series)
        else:
            raise RuntimeError('Sequence `%s` is not requested to make any '
                               'internal data available to the user.'
                               % self.name)

    def _delseries(self):
        if self.diskflag:
            os.remove(self.filepath_int)
        elif self.ramflag:
            setattr(self.fastaccess, '_%s_array' % self.name, None)

    series = property(_getseries, _setseries, _delseries)

    def load_ext(self):
        """Load the external data series in accordance with
        `pub.timegrids.init` and store it as internal data.
        """
        if self.filetype_ext == 'npy':
            timegrid_data, values = self._load_npy()
        else:
            timegrid_data, values = self._load_asc()
        if self.shape != values.shape[1:]:
            raise RuntimeError(
                'The shape of sequence `%s` of element `%s` is `%s`, but '
                'according to the external data file `%s` it should be `%s`.'
                % (self.name, objecttools.devicename(self), self.shape,
                   self.filepath_ext, values.shape[1:]))
        if pub.timegrids.init.stepsize != timegrid_data.stepsize:
            raise RuntimeError(
                'According to external data file `%s`, the date time step '
                'of sequence `%s` of element `%s` is `%s`, but the actual '
                'simulation time step is `%s`.'
                % (self.filepath_ext, self.name, objecttools.devicename(self),
                   timegrid_data.stepsize, pub.timegrids.init.stepsize))
        elif pub.timegrids.init not in timegrid_data:
            if pub.options.checkseries:
                raise RuntimeError(
                    'For sequence `%s` of element `%s` the initialization '
                    'time grid (%s) does not define a subset of the time '
                    'grid of the external data file %s (%s).'
                    % (self.name, objecttools.devicename(self),
                       pub.timegrids.init, self.filepath_ext, timegrid_data))
            else:
                values = self.adjust_short_series(timegrid_data, values)
        else:
            idx1 = timegrid_data[pub.timegrids.init.firstdate]
            idx2 = timegrid_data[pub.timegrids.init.lastdate]
            values = values[idx1:idx2]
        if self.diskflag:
            self._save_int(values)
        elif self.ramflag:
            self._setarray(values)
        else:
            raise RuntimeError(
                'Sequence `%s` of element `%s`is not requested to make '
                'any internal data available the the user.'
                % (self.name, objecttools.devicename(self)))

    def adjust_short_series(self, timegrid, values):
        """Adjust a short time series to a longer timegrid.

        Normally, time series data to be read from a external data files
        should span (at least) the whole initialization time period of a
        HydPy project.  However, for some variables which are only used
        for comparison (e.g. observed runoff used for calibration),
        incomplete time series might also be helpful.  This method it
        thought for adjusting such incomplete series to the public
        initialization time grid stored in module |pub|.  It is
        automatically called in method |IOSequence.load_ext| if necessary
        provided that the option |Options.checkseries| is disabled.

        Assume the initialization time period of a HydPy project spans
        five day:

        >>> from hydpy import pub, Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2000.01.10',
        ...                                    '2000.01.15',
        ...                                    '1d'))

        Prepare a node series object for observational data:

        >>> from hydpy.core.sequencetools import Obs
        >>> obs = Obs()

        Prepare a test function that expects the timegrid of the
        data and the data itself, which returns the ajdusted array by
        means of calling method |IOSequence.adjust_short_series|:

        >>> import numpy
        >>> def test(timegrid):
        ...     values = numpy.ones(len(timegrid))
        ...     return obs.adjust_short_series(timegrid, values)

        The following calls to the test function shows the arrays
        returned for different kinds misalignments:

        >>> test(Timegrid('2000.01.05', '2000.01.20', '1d'))
        array([ 1.,  1.,  1.,  1.,  1.])
        >>> test(Timegrid('2000.01.12', '2000.01.15', '1d'))
        array([ nan,  nan,   1.,   1.,   1.])
        >>> test(Timegrid('2000.01.12', '2000.01.17', '1d'))
        array([ nan,  nan,   1.,   1.,   1.])
        >>> test(Timegrid('2000.01.10', '2000.01.13', '1d'))
        array([  1.,   1.,   1.,  nan,  nan])
        >>> test(Timegrid('2000.01.08', '2000.01.13', '1d'))
        array([  1.,   1.,   1.,  nan,  nan])
        >>> test(Timegrid('2000.01.12', '2000.01.13', '1d'))
        array([ nan,  nan,   1.,  nan,  nan])
        >>> test(Timegrid('2000.01.05', '2000.01.10', '1d'))
        array([ nan,  nan,  nan,  nan,  nan])
        >>> test(Timegrid('2000.01.05', '2000.01.08', '1d'))
        array([ nan,  nan,  nan,  nan,  nan])
        >>> test(Timegrid('2000.01.15', '2000.01.18', '1d'))
        array([ nan,  nan,  nan,  nan,  nan])
        >>> test(Timegrid('2000.01.16', '2000.01.18', '1d'))
        array([ nan,  nan,  nan,  nan,  nan])

        Through enabling option |Options.usedefaultvalues| the missing
        values are initialized with zero instead of nan:

        >>> pub.options.usedefaultvalues = True

        >>> test(Timegrid('2000.01.12', '2000.01.17', '1d'))
        array([ 0.,  0.,  1.,  1.,  1.])

        >>> pub.options.usedefaultvalues = False
        """
        idxs = [timegrid[pub.timegrids.init.firstdate],
                timegrid[pub.timegrids.init.lastdate]]
        valcopy = values
        values = numpy.full(self.seriesshape, self.initvalue)
        len_ = len(valcopy)
        jdxs = []
        for idx in idxs:
            if idx < 0:
                jdxs.append(0)
            elif idx <= len_:
                jdxs.append(idx)
            else:
                jdxs.append(len_)
        valcopy = valcopy[jdxs[0]:jdxs[1]]
        zdx1 = max(-idxs[0], 0)
        zdx2 = zdx1+jdxs[1]-jdxs[0]
        values[zdx1:zdx2] = valcopy
        return values

    def save_ext(self):
        """Write the internal data into an external data file."""
        if self.filetype_ext == 'npy':
            series = pub.timegrids.init.array2series(self.series)
            numpy.save(self.filepath_ext, series)
        else:
            with open(self.filepath_ext, 'w') as file_:
                file_.write(repr(pub.timegrids.init) + '\n')
            with open(self.filepath_ext, 'ab') as file_:
                numpy.savetxt(file_, self.series, delimiter='\t')

    def _load_npy(self):
        """Return the data timegrid and the complete external data from a
        binary numpy file.
        """
        try:
            data = numpy.load(self.filepath_ext)
        except BaseException:
            prefix = ('While trying to load the external data of sequence '
                      '`%s` from file `%s`' % (self.name, self.filepath_ext))
            objecttools.augment_excmessage(prefix)
        try:
            timegrid_data = timetools.Timegrid.fromarray(data)
        except BaseException:
            prefix = ('While trying to retrieve the data timegrid of the '
                      'external data file `%s` of sequence `%s`'
                      % (self.filepath_ext, self.name))
            objecttools.augment_excmessage(prefix)
        return timegrid_data, data[13:]

    def _load_asc(self):
        with open(self.filepath_ext) as file_:
            header = '\n'.join([file_.readline() for idx in range(3)])
        timegrid_data = eval(header, {}, {'Timegrid': timetools.Timegrid})
        values = numpy.loadtxt(self.filepath_ext, skiprows=3,
                               ndmin=self.NDIM+1)
        return timegrid_data, values

    def _load_int(self):
        """Load internal data from file and return it."""
        values = numpy.fromfile(self.filepath_int)
        if self.NDIM > 0:
            values = values.reshape(self.seriesshape)
        return values

    def zero_int(self):
        """Initialize the internal data series with zero values."""
        values = numpy.zeros(self.seriesshape)
        if self.diskflag:
            self._save_int(values)
        elif self.ramflag:
            self._setarray(values)
        else:
            raise RuntimeError(
                'Sequence `%s` is not requested to make any '
                'internal data available to the user.'
                % self.name)

    def _save_int(self, values):
        values.tofile(self.filepath_int)

    def activate_disk(self):
        """Demand reading/writing internal data from/to hard disk."""
        self.deactivate_ram()
        self.diskflag = True
        if (isinstance(self, InputSequence) or
                (isinstance(self, NodeSequence) and self.use_ext)):
            self.load_ext()
        else:
            self.zero_int()
        self.update_fastaccess()

    def deactivate_disk(self):
        """Prevent from reading/writing internal data from/to hard disk."""
        if self.diskflag:
            del self.series
            self.diskflag = False

    def activate_ram(self):
        """Demand reading/writing internal data from/to hard disk."""
        self.deactivate_disk()
        self.ramflag = True
        if (isinstance(self, InputSequence) or
                (isinstance(self, NodeSequence) and self.use_ext)):
            self.load_ext()
        else:
            self.zero_int()
        self.update_fastaccess()

    def deactivate_ram(self):
        """Prevent from reading/writing internal data from/to hard disk."""
        if self.ramflag:
            del self.series
            self.ramflag = False

    def disk2ram(self):
        """Move internal data from disk to RAM."""
        values = self.series
        self.deactivate_disk()
        self.ramflag = True
        self._setarray(values)
        self.update_fastaccess()

    def ram2disk(self):
        """Move internal data from RAM to disk."""
        values = self.series
        self.deactivate_ram()
        self.diskflag = True
        self._save_int(values)
        self.update_fastaccess()

    def _setshape(self, shape):
        Sequence._setshape(self, shape)
        self.update_fastaccess()

    shape = property(Sequence._getshape, _setshape)


class ModelIOSequence(IOSequence):
    """Base class for sequences to be handled by |Model| objects."""

    def _getrawfilename(self):
        """Filename without ending for external and internal date files."""
        if self._rawfilename:
            return self._rawfilename
        else:
            try:
                return '%s_%s_%s' % (
                    self.subseqs.seqs.model.element.name,
                    objecttools.classname(self.subseqs)[:-9].lower(),
                    self.name)
            except AttributeError:
                raise RuntimeError(
                    'For sequence `%s` the raw filename cannot determined.  '
                    'Either set it manually or embed the sequence object '
                    'into the HydPy framework in the common manner to allow '
                    'for an automatic determination.'
                    % self.name)

    def _setrawfilename(self, name):
        self._rawfilename = str(name)

    def _delrawfilename(self):
        self._rawfilename = None

    rawfilename = property(_getrawfilename, _setrawfilename, _delrawfilename)


class InputSequence(ModelIOSequence):
    """Base class for input sequences of |Model| objects."""


abctools.InputSequenceABC.register(InputSequence)


class FluxSequence(ModelIOSequence):
    """Base class for flux sequences of |Model| objects."""

    def _initvalues(self):
        ModelIOSequence._initvalues(self)
        if self.NUMERIC:
            value = None if self.NDIM else numpy.zeros(self.numericshape)
            self._connect_subattr('points', value)
            self._connect_subattr('integrals', copy.copy(value))
            self._connect_subattr('results', copy.copy(value))
            value = None if self.NDIM else 0.
            self._connect_subattr('sum', value)

    def _setshape(self, shape):
        ModelIOSequence._setshape(self, shape)
        if self.NDIM and self.NUMERIC:
            self._connect_subattr('points', numpy.zeros(self.numericshape))
            self._connect_subattr('integrals', numpy.zeros(self.numericshape))
            self._connect_subattr('results', numpy.zeros(self.numericshape))
            self._connect_subattr('sum', numpy.zeros(self.shape))

    shape = property(ModelIOSequence._getshape, _setshape)


abctools.FluxSequenceABC.register(FluxSequence)


class LeftRightSequence(ModelIOSequence):
    NDIM = 1

    def _initvalues(self):
        setattr(self.fastaccess, self.name,
                numpy.full(2, self.initvalue, dtype=float))

    def _getleft(self):
        """The "left" value of the actual parameter."""
        return self.values[0]

    def _setleft(self, value):
        self.values[0] = value

    left = property(_getleft, _setleft)

    def _getright(self):
        """The "right" value of the actual parameter."""
        return self.values[1]

    def _setright(self, value):
        self.values[1] = value

    right = property(_getright, _setright)


class ConditionSequence(object):

    def __call__(self, *args):
        self.values = args
        self.trim()
        self._oldargs = copy.deepcopy(args)

    def trim(self, lower=None, upper=None):
        """Apply |trim| of module |variabletools|."""
        variabletools.trim(self, lower, upper)

    def warn_trim(self):
        warnings.warn(
            'For sequence %s of element %s at least one value '
            'needed to be trimmed.  One possible reason could be '
            'that the related control parameter and initial '
            'condition files are inconsistent.'
            % (self.name, objecttools.devicename(self)))

    def reset(self):
        if self._oldargs:
            self(*self._oldargs)


class StateSequence(ModelIOSequence, ConditionSequence):
    """Base class for state sequences of |Model| objects."""

    NOT_DEEPCOPYABLE_MEMBERS = ('subseqs', 'fastaccess_old', 'fastaccess_new')

    def __init__(self):
        ModelIOSequence.__init__(self)
        self.fastaccess_old = None
        self.fastaccess_new = None
        self._oldargs = None

    def __call__(self, *args):
        """The prefered way to pass values to |Sequence| instances within
        initial condition files.
        """
        ConditionSequence.__call__(self, *args)
        self.new2old()

    def connect(self, subseqs):
        ModelIOSequence.connect(self, subseqs)
        self.fastaccess_old = subseqs.fastaccess_old
        self.fastaccess_new = subseqs.fastaccess_new
        if self.NDIM:
            setattr(self.fastaccess_old, self.name, None)
        else:
            setattr(self.fastaccess_old, self.name, 0.)

    def _initvalues(self):
        ModelIOSequence._initvalues(self)
        if self.NUMERIC:
            value = None if self.NDIM else numpy.zeros(self.numericshape)
            self._connect_subattr('points', value)
            self._connect_subattr('results', copy.copy(value))

    def _setshape(self, shape):
        ModelIOSequence._setshape(self, shape)
        if self.NDIM:
            setattr(self.fastaccess_old, self.name, self.new.copy())
            if self.NUMERIC:
                self._connect_subattr('points',
                                      numpy.zeros(self.numericshape))
                self._connect_subattr('results',
                                      numpy.zeros(self.numericshape))

    shape = property(ModelIOSequence._getshape, _setshape)

    new = Sequence.values
    """Complete access to the state value(s), which will be used in the
    next calculation steps.  Note that |StateSequence.new| is a synonym
    of |Sequence.values|.  Use this property to modify the initial
    condition(s) of a single |StateSequence| object.
    """

    def _getold(self):
        """Assess to the state value(s) at beginning of the time step, which
        has been processed most recently.  When using :ref:`HydPy` in the
        normal manner.  But it can be helpful for demonstration and debugging
        purposes.
        """
        value = getattr(self.fastaccess_old, self.name, None)
        if value is None:
            raise RuntimeError('No value/values of sequence `%s` has/have '
                               'not been defined so far.' % self.name)
        else:
            if self.NDIM:
                value = numpy.asarray(value)
            return value

    def _setold(self, value):
        if self.NDIM == 0:
            try:
                temp = value[0]
                if len(value) > 1:
                    raise ValueError(
                        '%d values are assigned to the scalar '
                        'sequence `%s`, which is ambiguous.'
                        % (len(value)), self.name)
                value = temp
            except (TypeError, IndexError):
                pass
            try:
                value = float(value)
            except (ValueError, TypeError):
                raise TypeError(
                    'When trying to set the value of sequence `%s`, '
                    'it was not possible to convert `%s` to float.'
                    % (self.name, value))
        else:
            try:
                value = value.value
            except AttributeError:
                pass
            try:
                value = numpy.full(self.shape, value, dtype=float)
            except ValueError:
                raise ValueError(
                    'The values `%s` cannot be converted to a numpy '
                    'ndarray with shape %s containing entries of type float.'
                    % (value, self.shape))
        setattr(self.fastaccess_old, self.name, value)

    old = property(_getold, _setold)

    def new2old(self):
        if self.NDIM:
            self.old[:] = self.new[:]
        else:
            self.old = self.new


abctools.StateSequenceABC.register(StateSequence)


class LogSequence(Sequence, ConditionSequence):
    """Base class for logging sequences of |Model| objects."""

    def __init__(self):
        Sequence.__init__(self)
        self._oldargs = None

    def __call__(self, *args):
        self.values = args
        self.trim()
        self._oldargs = copy.deepcopy(args)


abctools.LogSequenceABC.register(LogSequence)


class AideSequence(Sequence):
    """Base class for aide sequences of |Model| objects."""
    pass


abctools.AideSequenceABC.register(AideSequence)


class LinkSequence(Sequence):
    """Base class for link sequences of |Model| objects."""

    def set_pointer(self, double, idx=0):
        pdouble = pointerutils.PDouble(double)
        if self.NDIM == 0:
            try:
                self.fastaccess.set_pointer0d(self.name, pdouble)
            except AttributeError:
                setattr(self.fastaccess, self.name, pdouble)
        elif self.NDIM == 1:
            try:
                self.fastaccess.set_pointer1d(self.name, pdouble, idx)
            except AttributeError:
                ppdouble = getattr(self.fastaccess, self.name)
                ppdouble.set_pointer(double, idx)

    def _initvalues(self):
        value = pointerutils.PPDouble() if self.NDIM else None
        try:
            setattr(self.fastaccess, self.name, value)
        except AttributeError:
            pass

    def _getvalue(self):
        """ToDo"""
        raise AttributeError(
            'To retrieve a pointer is very likely to result in bugs '
            'and is thus not supported at the moment.')

    def _setvalue(self, value):
        """Could be implemented, but is not important at the moment..."""
        raise AttributeError(
            'To change a pointer is very likely to result in bugs '
            'and is thus not supported at the moment.')

    value = property(_getvalue, _setvalue)
    values = value

    def _getshape(self):
        if self.NDIM == 0:
            return ()
        elif self.NDIM == 1:
            try:
                return getattr(self.fastaccess, self.name).shape
            except AttributeError:
                return (getattr(self.fastaccess, '_%s_length_0' % self.name),)
        raise NotImplementedError(
            'Getting the shape of a %d dimensional link sequence '
            'is not supported so far.'
            % self.NDIM)

    def _setshape(self, shape):
        if self.NDIM == 1:
            try:
                getattr(self.fastaccess, self.name).shape = shape
            except AttributeError:
                self.fastaccess.dealloc()
                self.fastaccess.alloc(self.name, shape)
            setattr(self.fastaccess, 'len_'+self.name, self.shape[0])
        elif self.NDIM > 1:
            raise NotImplementedError(
                'Setting the shape of a %d dimensional link sequence '
                'is not supported so far.'
                % self.NDIM)

    shape = property(_getshape, _setshape)


abctools.LinkSequenceABC.register(LinkSequence)


class NodeSequence(IOSequence):
    """Base class for all sequences to be handled by |Node| objects."""

    def _getrawfilename(self):
        """Filename without ending for external and internal date files."""
        if self._rawfilename:
            return self._rawfilename
        else:
            try:
                return '%s_%s_%s' % (
                    self.subseqs.node.name,
                    self.name,
                    self.subseqs.node.variable.lower())
            except AttributeError:
                raise RuntimeError(
                    'For sequence `%s` the raw filename cannot determined.  '
                    'Either set it manually or embed the sequence object '
                    'into the HydPy framework in the common manner to allow '
                    'for an automatic determination.'
                    % self.name)

    def _setrawfilename(self, name):
        self._rawfilename = str(name)

    def _delrawfilename(self):
        self._rawfilename = None

    rawfilename = property(_getrawfilename, _setrawfilename, _delrawfilename)

    def _initvalues(self):
        setattr(self.fastaccess, self.name, pointerutils.Double(0.))

    def _getvalues(self):
        """Actual value(s) handled by the sequence.  For consistency,
        `value` and `values` can always be used interchangeably."""
        try:
            return getattr(self.fastaccess, self.name)
        except AttributeError:
            if self.NDIM == 0:
                return self.fastaccess.getpointer0d(self.name)
            elif self.NDIM == 1:
                return self.fastaccess.getpointer1d(self.name)

    def _setvalues(self, values):
        getattr(self.fastaccess, self.name)[0] = values

    values = property(_getvalues, _setvalues)
    value = values


abctools.NodeSequenceABC.register(NodeSequence)


class Sim(NodeSequence):
    """Base class for simulation sequences of |Node| objects."""
    NDIM, NUMERIC = 0, False

    def __init__(self):
        NodeSequence.__init__(self)
        self.use_ext = False

    def activate_disk(self):
        try:
            NodeSequence.activate_disk(self)
        except IOError:
            message = sys.exc_info()[1]
            self.diskflag = False
            if pub.options.warnmissingsimfile:
                warnings.warn(
                    'The option `diskflag` of the simulation '
                    'sequence `%s` had to be set to `False` due '
                    'to the following problem: %s.'
                    % (objecttools.devicename(self), message))

    def activate_ram(self):
        try:
            NodeSequence.activate_ram(self)
        except IOError:
            message = sys.exc_info()[1]
            self.ramflag = False
            if pub.options.warnmissingsimfile:
                warnings.warn(
                    'The option `ramflag` of the simulation '
                    'sequence `%s` had to be set to `False` due '
                    'to the following problem: %s.'
                    % (objecttools.devicename(self), message))


class Obs(NodeSequence):
    """Base class for observation sequences of |Node| objects."""
    NDIM, NUMERIC = 0, False

    def __init__(self):
        NodeSequence.__init__(self)
        self.use_ext = True

    def activate_disk(self):
        try:
            NodeSequence.activate_disk(self)
        except IOError:
            message = sys.exc_info()[1]
            self.diskflag = False
            if pub.options.warnmissingobsfile:
                warnings.warn(
                    'The option `diskflag` of the observation '
                    'sequence `%s` had to be set to `False` due '
                    'to the following problem: %s.'
                    % (objecttools.devicename(self), message))

    def activate_ram(self):
        try:
            NodeSequence.activate_ram(self)
        except IOError:
            message = sys.exc_info()[1]
            self.ramflag = False
            if pub.options.warnmissingobsfile:
                warnings.warn(
                    'The option `ramflag` of the observation '
                    'sequence `%s` had to be set to `False` due '
                    'to the following problem: %s.'
                    % (objecttools.devicename(self), message))

    @property
    def series_complete(self):
        return self.memoryflag and not numpy.any(numpy.isnan(self.series))


class NodeSequences(IOSequences):
    """Base class for handling node sequences."""
    _SEQCLASSES = (Sim, Obs)

    def __init__(self, seqs, cls_fastaccess=None):
        IOSequences.__init__(self, seqs, cls_fastaccess)
        self.node = seqs

    def load_data(self, idx):
        self.fastaccess.load_data(idx)

    def save_data(self, idx):
        self.fastaccess.save_data(idx)


class FastAccess(object):
    """Provides fast access to the values of the sequences of a sequence
    subgroup and supports the handling of internal data series during
    simulations.

    The following details are of relevance for :ref:`HydPy` developers only.

    |sequencetools.FastAccess| is applied in Python mode only.  In Cython
    mode, specialized and more efficient cdef classes replace it.  For
    compatibility with these cdef classes, |sequencetools.FastAccess|
    objects work with dynamically set instance members.  Suppose there
    is a sequence named `seq1` which is 2-dimensional, then its associated
    attributes are:

      * seq1 (|numpy.ndarray|): The actual sequence values.
      * _seq1_ndim (|int|): Number of dimensions.
      * _seq1_length_0 (|int|): Length in the first dimension.
      * _seq1_length_1 (|int|): Length in the second dimension.
      * _seq1_ramflag (|bool|): Handle internal data in RAM?
      * _seq1_diskflag (|bool|): Handle internal data on disk?
      * _seq1_path (|str|): Path of the internal data file.
      * _seq1_file (|io.open|): Object handling the internal data file.

    Note that all these dynamical attributes and the following methods are
    initialised, changed or applied by the respective |SubSequences| and
    |Sequence| objects.  Handling them directly is error prone and thus
    not recommended.
    """

    def open_files(self, idx):
        """Open all files with an activated disk flag."""
        for name in self:
            if getattr(self, '_%s_diskflag' % name):
                path = getattr(self, '_%s_path' % name)
                file_ = open(path, 'rb+')
                ndim = getattr(self, '_%s_ndim' % name)
                position = 8*idx
                for idim in range(ndim):
                    length = getattr(self, '_%s_length_%d' % (name, idim))
                    position *= length
                file_.seek(position)
                setattr(self, '_%s_file' % name, file_)

    def close_files(self):
        """Close all files with an activated disk flag."""
        for name in self:
            if getattr(self, '_%s_diskflag' % name):
                file_ = getattr(self, '_%s_file' % name)
                file_.close()

    def load_data(self, idx):
        """Load the internal data of all sequences.  Load from file if the
        corresponding disk flag is activated, otherwise load from RAM."""
        for name in self:
            ndim = getattr(self, '_%s_ndim' % name)
            diskflag = getattr(self, '_%s_diskflag' % name)
            ramflag = getattr(self, '_%s_ramflag' % name)
            if diskflag:
                file_ = getattr(self, '_%s_file' % name)
                length_tot = 1
                shape = []
                for jdx in range(ndim):
                    length = getattr(self, '_%s_length_%s' % (name, jdx))
                    length_tot *= length
                    shape.append(length)
                raw = file_.read(length_tot*8)
                values = struct.unpack(length_tot*'d', raw)
                if ndim:
                    values = numpy.array(values).reshape(shape)
                else:
                    values = values[0]
            elif ramflag:
                array = getattr(self, '_%s_array' % name)
                values = array[idx]
            if (diskflag or ramflag):
                if ndim == 0:
                    setattr(self, name, values)
                else:
                    getattr(self, name)[:] = values

    def save_data(self, idx):
        """Save the internal data of all sequences with an activated flag.
        Write to file if the corresponding disk flag is activated; store
        in working memory if the corresponding ram flag is activated."""
        for name in self:
            actual = getattr(self, name)
            diskflag = getattr(self, '_%s_diskflag' % name)
            ramflag = getattr(self, '_%s_ramflag' % name)
            if diskflag:
                file_ = getattr(self, '_%s_file' % name)
                ndim = getattr(self, '_%s_ndim' % name)
                length_tot = 1
                for jdx in range(ndim):
                    length = getattr(self, '_%s_length_%s' % (name, jdx))
                    length_tot *= length
                if ndim:
                    raw = struct.pack(length_tot*'d', *actual.flatten())
                else:
                    raw = struct.pack('d', actual)
                file_.write(raw)
            elif ramflag:
                array = getattr(self, '_%s_array' % name)
                array[idx] = actual

    def __iter__(self):
        """Iterate over all sequence names."""
        for key in vars(self).keys():
            if not key.startswith('_'):
                yield key


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/testtools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
# -*- coding: utf-8 -*-
"""This module implements tools for making doctests more legible."""
# import...
# ...from standard library
from __future__ import division, print_function
import abc
import sys
from hydpy import builtins
import datetime
import doctest
import importlib
import inspect
import itertools
import os
import warnings
# ...from site-packages
# the following import are actually performed below due to performance issues:
# import bokeh.models
# import bokeh.palettes
# import bokeh.plotting
import numpy
# ...from HydPy
import hydpy
from hydpy import pub
from hydpy import docs
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import devicetools
from hydpy.core import exceptiontools
from hydpy.core import hydpytools
from hydpy.core import objecttools
from hydpy.core import parametertools
from hydpy.core import printtools
from hydpy.core import selectiontools
from hydpy.core import timetools


if pub.pyversion == 2:
    abstractstaticmethod = abc.abstractmethod
else:
    abstractstaticmethod = abc.abstractstaticmethod


class StdOutErr(object):

    def __init__(self, indent=0):
        self.indent = indent
        self.stdout = sys.stdout
        self.stderr = sys.stderr
        self.encoding = sys.stdout.encoding
        self.texts = []

    def __enter__(self):
        self.encoding = sys.stdout.encoding
        sys.stdout = self
        sys.stderr = self

    def __exit__(self, exception, message, traceback_):
        if not self.texts:
            self.print_('no failures occurred')
        else:
            for text in self.texts:
                self.print_(text)
        sys.stdout = self.stdout
        sys.stderr = self.stderr
        if exception:
            objecttools.augment_excmessage()

    def write(self, text):
        self.texts.extend(text.split('\n'))

    def print_(self, text):
        if text.strip():
            self.stdout.write(self.indent*' ' + text + '\n')

    def flush(self):
        pass


class Tester(object):
    """Tests either a base or an application model.

    Usually, a |Tester| object is initialized at the end of the `__init__`
    file of its base model or at the end of the module of an application
    modele.
    """

    def __init__(self):
        frame = inspect.currentframe().f_back
        self.filepath = frame.f_code.co_filename
        self.package = frame.f_locals['__package__']
        self.ispackage = os.path.split(self.filepath)[-1] == '__init__.py'

    @property
    def filenames(self):
        """|list| of all filenames to be taken into account for testing."""
        if self.ispackage:
            return os.listdir(os.path.dirname(self.filepath))
        return [self.filepath]

    @property
    def modulenames(self):
        """|list| of all module names to be taken into account for testing."""
        return [os.path.split(fn)[-1].split('.')[0] for fn in self.filenames
                if (fn.endswith('.py') and not fn.startswith('_'))]

    def doit(self):
        """Perform all doctests either in Python or in Cython mode depending
        on the state of |Options.usecython| set in module |pub|.

        Usually, |Tester.doit| is triggered automatically by a |Cythonizer|
        object assigned to the same base or application model as a
        |Tester| object.
        """
        opt = pub.options
        par = parametertools.Parameter
        with opt.usedefaultvalues(False), \
                opt.usedefaultvalues(False), \
                opt.printprogress(False), \
                opt.printincolor(False), \
                opt.warnsimulationstep(False), \
                opt.reprcomments(False), \
                opt.ellipsis(0), \
                opt.reprdigits(6), \
                opt.warntrim(False), \
                par.parameterstep.delete(), \
                par.simulationstep.delete():
            timegrids = pub.timegrids
            pub.timegrids = None
            nodes = devicetools.Node._registry.copy()
            elements = devicetools.Element._registry.copy()
            devicetools.Node.clear_registry()
            devicetools.Element.clear_registry()
            plotting_options = IntegrationTest.plotting_options
            IntegrationTest.plotting_options = PlottingOptions()
            try:
                color = 34 if pub.options.usecython else 36
                with printtools.PrintStyle(color=color, font=4):
                    print(
                        'Test %s %s in %sython mode.'
                        % ('package' if self.ispackage else 'module',
                           self.package if self.ispackage else
                           self.modulenames[0],
                           'C' if pub.options.usecython else 'P'))
                with printtools.PrintStyle(color=color, font=2):
                    for name in self.modulenames:
                        print('    * %s:' % name, )
                        with StdOutErr(indent=8):
                            modulename = '.'.join((self.package, name))
                            module = importlib.import_module(modulename)
                            solve_exception_doctest_issue(module)
                            with warnings.catch_warnings():
                                warnings.filterwarnings(
                                    'error', module=modulename)
                                warnings.filterwarnings(
                                    'ignore', category=ImportWarning)
                                doctest.testmod(
                                    module, extraglobs={'testing': True},
                                    optionflags=doctest.ELLIPSIS)
            finally:
                pub.timegrids = timegrids
                devicetools.Node.clear_registry()
                devicetools.Element.clear_registry()
                devicetools.Node._registry = nodes
                devicetools.Element._registry = elements
                IntegrationTest.plotting_options = plotting_options
                hydpy.dummies.clear()


class Array(object):
    """Assures that attributes are |numpy.ndarray| objects."""

    def __setattr__(self, name, value):
        object.__setattr__(self, name, numpy.array(value))


class ArrayDescriptor(object):
    """Descriptor for handling values of |Array| objects."""

    def __init__(self):
        self.values = Array()

    def __set__(self, obj, values):
        self.__delete__(obj)
        if values is not None:
            for (key, value) in values:
                setattr(self.values, key.name, value)

    def __get__(self, obj, type_=None):
        return self.values

    def __delete__(self, obj):
        for name in list(vars(self.values).keys()):
            delattr(self.values, name)


class Test(object):
    """Base class for |IntegrationTest| and |UnitTest|.

    This base class defines the printing of the test results primarily.
    How the tests shall be prepared and performed, is to be defined in
    its subclasses.
    """

    inits = ArrayDescriptor()
    """Stores arrays for setting the same values of parameters and/or
    sequences before each new experiment."""

    @abc.abstractproperty
    def raw_first_col_strings(self):
        """To be implemented by the subclasses of |Test|."""
        return NotImplementedError

    @abstractstaticmethod
    def get_output_array(parseq):
        # pylint: disable=unused-argument
        """To be implemented by the subclasses of |Test|."""
        return NotImplementedError

    parseqs = NotImplemented

    HEADER_OF_FIRST_COL = NotImplemented

    @property
    def nmb_rows(self):
        """Number of rows of the table."""
        return len(self.raw_first_col_strings)+1

    @property
    def nmb_cols(self):
        """Number of columns of the table."""
        nmb = 1
        for parseq in self.parseqs:
            nmb += max(parseq.length, 1)
        return nmb

    @property
    def raw_header_strings(self):
        """All raw strings for the tables header."""
        strings = [self.HEADER_OF_FIRST_COL]
        for parseq in self.parseqs:
            for dummy in range(parseq.length-1):
                strings.append('')
            if ((parseq.name == 'sim') and
                    isinstance(parseq, abctools.SequenceABC)):
                strings.append(parseq.subseqs.node.name)
            else:
                strings.append(parseq.name)
        return strings

    @property
    def raw_body_strings(self):
        """All raw strings for the tables body."""
        strings = []
        for (idx, first_string) in enumerate(self.raw_first_col_strings):
            strings.append([first_string])
            for parseq in self.parseqs:
                array = self.get_output_array(parseq)
                if parseq.NDIM == 0:
                    strings[-1].append(objecttools.repr_(array[idx]))
                elif parseq.NDIM == 1:
                    if parseq.shape[0] > 0:
                        strings[-1].extend(
                            objecttools.repr_(value) for value in array[idx])
                    else:
                        strings[-1].append('empty')
                else:
                    thing = ('sequence'
                             if isinstance(parseq, abctools.SequenceABC)
                             else 'parameter')
                    raise RuntimeError(
                        'An instance of class `Test` of module `testtools` '
                        'is requested to print the results of %s `%s`. '
                        'Unfortunately, for %d-dimensional sequences this '
                        'feature is not supported yet.'
                        % (thing, parseq.name, parseq.NDIM))
        return strings

    @property
    def raw_strings(self):
        """All raw strings for the complete table."""
        return [self.raw_header_strings] + self.raw_body_strings

    @property
    def col_widths(self):
        """The widths of all columns of the table."""
        strings = self.raw_strings
        widths = []
        for jdx in range(self.nmb_cols):
            widths.append(0)
            for idx in range(self.nmb_rows):
                widths[-1] = max(len(strings[idx][jdx]), widths[-1])
        return widths

    @property
    def col_seperators(self):
        """The seperators for adjacent columns."""
        seps = ['| ']
        for parseq in self.parseqs:
            seps.append(' | ')
            for dummy in range(parseq.length-1):
                seps.append('  ')
        seps.append(' |')
        return seps

    @property
    def row_nmb_characters(self):
        """Number of characters of a single row of the table."""
        return (sum(self.col_widths) +
                sum((len(sep) for sep in self.col_seperators)))

    @staticmethod
    def _interleave(seperators, strings, widths):
        """Generate a table line from the given arguments."""
        lst = [value for (seperator, string, width)
               in zip(seperators, strings, widths)
               for value in (seperator, string.rjust(width))]
        lst.append(seperators[-1])
        return ''.join(lst)

    def print_table(self, idx1=None, idx2=None):
        """Print the result table between the given indices."""
        col_widths = self.col_widths
        col_seperators = self.col_seperators
        print(self._interleave(self.col_seperators,
                               self.raw_header_strings,
                               col_widths))
        print('-'*self.row_nmb_characters)
        for strings_in_line in self.raw_body_strings[idx1:idx2]:
            print(self._interleave(col_seperators,
                                   strings_in_line,
                                   col_widths))

    def extract_units(self, parseqs=None):
        """Return a set of units of the given or the handled parameters
        and sequences."""
        if parseqs is None:
            parseqs = self.parseqs
        units = set()
        for parseq in parseqs:
            desc = autodoctools.description(parseq)
            if '[' in desc:
                unit = desc.split('[')[-1].split(']')[0]
                units.add(unit)
        return units


class PlottingOptions(object):
    """Plotting options of class |IntegrationTest|."""

    def __init__(self):
        self.width = 600
        self.height = 300
        self.activated = None
        self.selected = None
        self.skip_nodes = True


class IntegrationTest(Test):
    """Defines model integration doctests.

    The functionality of |IntegrationTest| is easiest to understand by
    inspecting doctests like the ones of modules |llake_v1| or |arma_v1|.

    Note that all condition sequences (state and logging sequences) are
    initialized in accordance with the values are given in the `inits`
    values.  The values of the simulation sequences of outlet and
    sender nodes are always set to zero before each test run.  All other
    parameter and sequence values can be changed between different test
    runs.
    """

    HEADER_OF_FIRST_COL = 'date'
    """The header of the first column containing dates."""

    _dateformat = None

    plotting_options = PlottingOptions()

    def __init__(self, element, seqs=None, inits=None):
        """Prepare the element and its nodes and put them into a HydPy object
        and make their sequences ready for use for integration testing."""
        del self.inits
        self.element = element
        self.elements = devicetools.Element.registered_elements()
        self.nodes = devicetools.Node.registered_nodes()
        self.prepare_node_sequences()
        self.prepare_input_model_sequences()
        self.parseqs = seqs if seqs else self.extract_print_sequences()
        self.inits = inits
        self.model = element.model
        hydpytools.HydPy.nmb_instances = 0
        self.hydpy = hydpytools.HydPy()
        self.hydpy.update_devices(
            selectiontools.Selection('test', self.nodes, self.elements))
        self._src = None
        self._width = None
        self._height = None

    def __call__(self, *args, **kwargs):
        """Prepare and perform an integration test and print and eventually
        plot its results.

        Plotting is only performed, when a filename is given as first
        argument.  Additionally, all other arguments of function
        |IntegrationTest.plot| are allowed to modify plot design.
        """
        self.prepare_model()
        self.hydpy.doit()
        self.print_table()
        if args:
            self.plot(*args, **kwargs)

    @property
    def _datetimes(self):
        return tuple(date.datetime for date in pub.timegrids.sim)

    @property
    def raw_first_col_strings(self):
        """The raw date strings of the first column, except the header."""
        return tuple(datetime.strftime(self.dateformat)
                     for datetime in self._datetimes)

    def _getdateformat(self):
        """Format string for printing dates in the first column of the table.

        See |datetime| for the format strings allowed.
        """
        if self._dateformat is None:
            return timetools.Date._formatstrings['iso']
        return self._dateformat

    def _setdateformat(self, dateformat):
        try:
            dateformat = str(dateformat)
        except BaseException:
            raise TypeError(
                'The given `dateformat` of type `%s` could not be converted '
                'to a `str` instance.' % objecttools.classname(dateformat))
        try:
            datetime.datetime(2000, 1, 1).strftime(dateformat)
        except BaseException:
            raise ValueError(
                "The given `dateformat` `%s` is not a valid format string "
                "for `datetime` objects.  Please read the documentation "
                "on module `datetime` of Python's the standard library "
                "for further information." % dateformat)
        self._dateformat = dateformat

    dateformat = property(_getdateformat, _setdateformat)

    @staticmethod
    def get_output_array(seq):
        """Return the array containing the output results of the given
        sequence."""
        return seq.series

    def prepare_node_sequences(self):
        """Prepare the simulations sequences of all nodes in.

        This preparation might not be suitable for all types of integration
        tests.  Prepare those node sequences manually, for which this method
        does not result in the desired outcome."""
        for node in self.nodes:
            if not node.entries:
                node.deploymode = 'oldsim'
            sim = node.sequences.sim
            sim.ramflag = True
            sim._setarray(numpy.zeros(len(pub.timegrids.init), dtype=float))

    def prepare_input_model_sequences(self):
        """Configure the input sequences of the model in a manner that allows
        for applying their time series data in integration tests."""
        subseqs = getattr(self.element.model.sequences, 'inputs', ())
        for seq in subseqs:
            seq.ramflag = True
            seq._setarray(numpy.zeros(len(pub.timegrids.init), dtype=float))

    def extract_print_sequences(self):
        """Return a list of all input, flux and state sequences of the model
        as well as the simulation sequences of all nodes."""
        seqs = []
        for name in ('inputs', 'fluxes', 'states'):
            subseqs = getattr(self.element.model.sequences, name, ())
            for seq in subseqs:
                seqs.append(seq)
        for node in self.nodes:
            seqs.append(node.sequences.sim)
        return seqs

    def prepare_model(self):
        """Derive the secondary parameter values, prepare all required time
        series and set the initial conditions.
        """
        self.model.parameters.update()
        self.element.prepare_fluxseries()
        self.element.prepare_stateseries()
        self.reset_outputs()
        self.reset_inits()

    def reset_outputs(self):
        """Set the values of the simulation sequences of all outlet nodes to
        zero."""
        for node in self.nodes:
            if ((node in self.element.outlets) or
                    (node in self.element.senders)):
                node.sequences.sim[:] = 0.

    def reset_inits(self):
        """Set all initial conditions of all models."""
        for subname in ('states', 'logs'):
            for element in self.elements:
                for seq in getattr(element.model.sequences, subname, ()):
                    try:
                        seq(getattr(self.inits, seq.name))
                    except AttributeError:
                        pass

    def plot(self, filename, width=None, height=None,
             selected=None, activated=None, skip_nodes=None):
        """Save a bokeh html file plotting the current test results.

        (Optional) arguments:
            * filename: Name of the file.  If necessary, the file ending
              `html` is added automatically.  The file is stored in the
              `html` folder of subpackage `docs`.
            * width: Width of the plot in screen units.  Defaults to 600.
            * height: Height of the plot in screen units.  Defaults to 300.
            * selected: List of the sequences to be plotted.
            * activated: List of the sequences to be shown initially.
            * skip_nodes: Boolean flag that indicates whether series of
              node objects shall be plotted or not. Defaults to `False`.
        """
        import bokeh.models
        import bokeh.palettes
        import bokeh.plotting
        if width is None:
            width = self.plotting_options.width
        if height is None:
            height = self.plotting_options.height
        if not filename.endswith('.html'):
            filename += '.html'
        if selected is None:
            selected = self.plotting_options.selected
            if selected is None:
                selected = self.parseqs
        if skip_nodes is None:
            skip_nodes = self.plotting_options.skip_nodes
        if skip_nodes:
            selected = [seq for seq in selected
                        if not isinstance(seq, abctools.NodeSequenceABC)]
        if activated is None:
            activated = self.plotting_options.activated
            if activated is None:
                activated = self.parseqs
        activated = tuple(nm_.name if hasattr(nm_, 'name') else nm_.lower()
                          for nm_ in activated)
        path = os.path.join(docs.__path__[0], 'html', filename)
        bokeh.plotting.output_file(path)
        plot = bokeh.plotting.figure(x_axis_type="datetime",
                                     tools=['pan', 'ywheel_zoom'],
                                     toolbar_location=None)
        plot.toolbar.active_drag = plot.tools[0]
        plot.toolbar.active_scroll = plot.tools[1]
        plot.plot_width = width
        plot.plot_height = height
        legend_entries = []
        viridis = bokeh.palettes.viridis   # pylint: disable=no-member
        headers = [header for header in self.raw_header_strings[1:]
                   if header]
        zipped = zip(selected,
                     viridis(len(selected)),
                     headers)
        for (seq, col, header) in zipped:
            series = seq.series.copy()
            if seq.NDIM == 0:
                listofseries = [series]
                listofsuffixes = ['']
            elif seq.NDIM == 1:
                nmb = seq.shape[0]
                listofseries = [series[:, idx] for idx in range(nmb)]
                if nmb == 1:
                    listofsuffixes = ['']
                else:
                    listofsuffixes = ['-%d' % idx for idx in range(nmb)]
            else:
                raise RuntimeError(
                    'IntegrationTest does not support plotting values of '
                    'sequences with more than 1 dimension so far, but '
                    'sequence `%s` is %d-dimensional.'
                    % (seq.name, seq.NDIM))
            for subseries, suffix in zip(listofseries, listofsuffixes):
                line = plot.line(self._datetimes, subseries,
                                 alpha=0.8, muted_alpha=0.0,
                                 line_width=2, color=col)
                line.muted = seq.name not in activated
                if header.strip() == seq.name:
                    title = objecttools.classname(seq)
                else:
                    title = header.capitalize()
                title += suffix
                legend_entries.append((title, [line]))
        legend = bokeh.models.Legend(items=legend_entries,
                                     click_policy='mute')
        legend.border_line_color = None
        plot.add_layout(legend, 'right')
        units = self.extract_units(selected)
        ylabel = objecttools.enumeration(units).replace('and', 'or')
        plot.yaxis.axis_label = ylabel
        plot.yaxis.axis_label_text_font_style = 'normal'
        bokeh.plotting.save(plot)
        self._src = filename
        self._width = width
        self._height = height

    def iframe(self, tabs=4):
        """Print a command for embeding the saved html file into the online
        documentation via an `iframe`."""
        blanks = ' '*tabs
        lines = ['.. raw:: html',
                 '',
                 '    <iframe',
                 '        src="%s"' % self._src,
                 '        width="100%"',
                 '        height="%dpx"' % (self._height+30),
                 '        frameborder=0',
                 '    ></iframe>',
                 '']
        print('\n'.join(blanks+line for line in lines))


class UnitTest(Test):
    """Defines unit doctests for a single model method."""

    HEADER_OF_FIRST_COL = 'ex.'
    """The header of the first column containing sequential numbers."""

    nexts = ArrayDescriptor()
    """Stores arrays for setting different values of parameters and/or
    sequences before each new experiment."""

    results = ArrayDescriptor()
    """Stores arrays with the resulting values of parameters and/or
    sequences of each new experiment."""

    def __init__(self, model, method, first_example=1, last_example=1,
                 parseqs=None):
        del self.inits
        del self.nexts
        del self.results
        self.model = model
        self.method = method
        self.doc = self.extract_method_doc()
        self.first_example_calc = first_example
        self.last_example_calc = last_example
        self.first_example_plot = first_example
        self.last_example_plot = last_example
        if parseqs:
            self.parseqs = parseqs
        else:
            self.parseqs = self.extract_print_parameters_and_sequences()
        self.memorize_inits()
        self.prepare_output_arrays()

    @property
    def nmb_examples(self):
        """The number of examples to be calculated."""
        return self.last_example_calc-self.first_example_calc+1

    @property
    def idx0(self):
        """First index of the examples selected for printing."""
        return self.first_example_plot-self.first_example_calc

    @property
    def idx1(self):
        """Last index of the examples selected for printing."""
        return self.nmb_examples-(self.last_example_calc -
                                  self.last_example_plot)

    def __call__(self, first_example=None, last_example=None):
        if first_example is None:
            self.first_example_plot = self.first_example_calc
        else:
            self.first_example_plot = first_example
        if last_example is None:
            self.last_example_plot = self.last_example_calc
        else:
            self.last_example_plot = last_example
        for idx in range(self.nmb_examples):
            self.reset_inits()
            self._update_inputs(idx)
            self.method()
            self._update_outputs(idx)
        self.print_table(self.idx0, self.idx1)

    def get_output_array(self, parseq):
        """Return the array containing the output results of the given
        parameter or sequence."""
        return getattr(self.results, parseq.name)

    @property
    def raw_first_col_strings(self):
        """The raw integer strings of the first column, except the header."""
        return [str(example) for example in
                range(self.first_example_plot, self.last_example_plot+1)]

    def memorize_inits(self):
        """Memorize all initial conditions."""
        for parseq in self.parseqs:
            setattr(self.inits, parseq.name, parseq.values)

    def prepare_output_arrays(self):
        """Prepare arrays for storing the calculated results for the
        respective parameters and/or sequences."""
        for parseq in self.parseqs:
            shape = [len(self.raw_first_col_strings)] + list(parseq.shape)
            type_ = getattr(parseq, 'TYPE', float)
            array = numpy.full(shape, numpy.nan, type_)
            setattr(self.results, parseq.name, array)

    def reset_inits(self):
        """Set all initial conditions."""
        for parseq in self.parseqs:
            inits = getattr(self.inits, parseq.name, None)
            if inits is not None:
                parseq(inits)

    def extract_method_doc(self):
        """Return the documentation string of the method to be tested."""
        if getattr(self.method, '__doc__', None):
            return self.method.__doc__
        else:
            model = type(self.model)
            for group_name in model._METHOD_GROUPS:
                for function in getattr(model, group_name, ()):
                    if function.__name__ == self.method.__name__:
                        return function.__doc__

    def extract_print_parameters_and_sequences(self):
        """Return a list of all parameter and sequences of the model.

        Note that all parameters and sequences without the common `values`
        attribute are omitted.
        """
        parseqs = []
        for subparseqs in itertools.chain(self.model.parameters,
                                          self.model.sequences):
            for parseq in subparseqs:
                if str(type(parseq)).split("'")[1] in self.doc:
                    if hasattr(parseq, 'values'):
                        parseqs.append(parseq)
        return tuple(parseqs)

    def _update_inputs(self, idx):
        """Update the actual values with the |UnitTest.nexts| data of
        the given index."""
        for parseq in self.parseqs:
            if hasattr(self.nexts, parseq.name):
                parseq(getattr(self.nexts, parseq.name)[idx])

    def _update_outputs(self, idx):
        """Update the |UnitTest.results| data with the actual values of
        the given index."""
        for parseq in self.parseqs:
            if hasattr(self.results, parseq.name):
                getattr(self.results, parseq.name)[idx] = parseq.values


class _Open(object):

    def __init__(self, path, mode, *args, **kwargs):
        # all positional and keyword arguments are ignored.
        self.path = path.replace(os.sep, '/')
        self.mode = mode
        self.texts = []
        self.entered = False

    def __enter__(self):
        self.entered = True
        return self

    def __exit__(self, exception, message, traceback_):
        self.close()

    def write(self, text):
        """Replaces the `write` method of file objects."""
        self.texts.append(text)

    def close(self):
        """Replaces the `close` method of file objects."""
        text = ''.join(self.texts)
        maxchars = len(self.path)
        lines = []
        for line in text.split('\n'):
            if not line:
                line = '<BLANKLINE>'
            lines.append(line)
            maxchars = max(maxchars, len(line))
        text = '\n'.join(lines)
        print('~'*maxchars)
        print(self.path)
        print('-'*maxchars)
        print(text)
        print('~'*maxchars)


class Open(object):
    """Replace |open| in doctests temporarily.

    Class |Open| to intended to make writing to files visible and testable
    in docstrings.  Therefore, Python's built in function |open| is
    temporarily replaced by another object, printing the filename and the
    file contend as shown in the following example:

    >>> import os
    >>> path = os.path.join('folder', 'test.py')
    >>> from hydpy import Open
    >>> with Open():
    ...     with open(path, 'w') as file_:
    ...         file_.write('first line\\n')
    ...         file_.write('\\n')
    ...         file_.write('third line\\n')
    ~~~~~~~~~~~~~~
    folder/test.py
    --------------
    first line
    <BLANKLINE>
    third line
    <BLANKLINE>
    ~~~~~~~~~~~~~~

    Note that, for simplicity, the UNIX style path seperator `/` is used
    to print the file path on all systems.

    Class |Open| is rather restricted at the moment.  More functionalities
    will be added later...
    """
    def __init__(self):
        self.open = builtins.open

    def __enter__(self):
        builtins.open = _Open
        return self

    def __exit__(self, exception, message, traceback_):
        builtins.open = self.open


def solve_exception_doctest_issue(module):
    """Insert the string `hydpy.core.exceptiontools.` into the
    docstrings of the given module related to exceptions defined
    in module |exceptiontools| (not relevant for Python 2)."""
    if pub.pyversion > 2:
        _replace(module)
        try:
            for member in vars(module).values():
                _replace(member)
                try:
                    for submember in vars(member).values():
                        submember = getattr(submember, '__func__', submember)
                        _replace(submember)
                except (TypeError, KeyError):
                    pass
        except TypeError:
            pass


def _replace(obj):
    try:
        doc = obj.__doc__
        for key, value in vars(exceptiontools).items():
            if inspect.isclass(value) and issubclass(value, BaseException):
                doc = doc.replace(
                    '    ' + key,
                    '    hydpy.core.exceptiontools.' + key)
                doc = doc.replace(
                    '\n' + key,
                    '\nhydpy.core.exceptiontools.' + key)
        obj.__doc__ = doc
    except BaseException:
        pass


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/timetools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
# -*- coding: utf-8 -*-
"""This module specifies how  dates and periods are handled in HydPy."""
# import...
# ...from standard library
from __future__ import division, print_function
import calendar
import collections
import copy
import datetime
import numbers
import time
import warnings
# ...from third party packages
import numpy
# ...from HydPy
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import objecttools


# The import of `_strptime` is not thread save.  The following call of
# `strptime` is supposed to prevent possible problems arising from this bug.
time.strptime('1999', '%Y')


class Date(object):
    """Handles a single date.

    Classes |Date| is build on top of the Python module |datetime|.
    In essence, it wraps the |datetime| class |datetime.datetime|,
    and is supposed to specialise this general class on the needs
    of HydPy users.

    Be aware of the different minimum time resolution of module |datetime|
    (microseconds) and module |timetools| (seconds).

    |Date| objects can be initialized via |datetime.datetime| objects
    directly, e.g.:

        >>> from datetime import datetime
        >>> from hydpy import Date
        >>> # Initialize a `datetime` object...
        >>> datetime_object = datetime(1996, 11, 1, 0, 0, 0)
        >>> # ...and use it to initialise a `Date` object.
        >>> date1 = Date(datetime_object)

    Alternatively, one can use |str| objects as initialization arguments,
    which need to match one of the following format styles:

        >>> # The `os` style without empty space and colon, which is applied in
        >>> # text files and folder names:
        >>> date2 = Date('1997_11_01_00_00_00')
        >>> # The `iso` style, which is more legible and in accordance with the
        >>> # international ISO norm:
        >>> date2 = Date('1997.11.01 00:00:00')
        >>> # The `din` style, which is more legible for users in countries
        >>> # where the position of day and year are interchanged (DIN refers
        >>> # to a german norm):
        >>> date2 = Date('01.11.1997 00:00:00')

    |Date| keeps the chosen style in mind and uses it for printing.
    But the user is also allowed to change it:

        >>> # Print in accordance with the `iso` style...
        >>> date2.string('iso')
        '1997.11.01 00:00:00'
        >>> # ...without changing the memorized `din` style:
        >>> date2.style
        'din'

        >>> # Alternatively, the style property can be set permanentely:
        >>> date2.style = 'iso'
        >>> str(date2)
        '1997.11.01 00:00:00'

    It is allowed to abbreviate the input strings. Using the `iso` style as an
    example:

        >>> # The following three input arguments...
        >>> test1 = Date('1996.11.01 00:00:00')
        >>> test2 = Date('1996.11.01 00:00')
        >>> test3 = Date('1996.11.01 00')
        >>> test4 = Date('1996.11.01')
        >>> # ...all lead to identical `Date` instances.
        >>> for test in (test1, test2, test3, test4):
        ...     print(test)
        1996.11.01 00:00:00
        1996.11.01 00:00:00
        1996.11.01 00:00:00
        1996.11.01 00:00:00

    If |Date| has not been initialized via a |str| object and the style
    property has not been set manually, the default style `iso` is selected.

    One can change the year, month... of a |Date| object via numbers:

        >>> # Assign an integer...
        >>> test4.year = 1997
        >>> # ...or something that can be converted to an integer.
        >>> test4.month = '10'
        >>> print(test4)
        1997.10.01 00:00:00

    One can ask for the actual water year, which depends on the selected
    reference month:

        >>> oct = Date('1996.10.01')
        >>> nov = Date('1996.11.01')
        >>> # Under the standard settings, the water year is assumed to start
        >>> # November.
        >>> oct.wateryear
        1996
        >>> nov.wateryear
        1997
        >>> # Changing the reference month via one `Date` object affects all
        >>> # objects.
        >>> test4.refmonth = 10
        >>> oct.wateryear
        1997
        >>> nov.wateryear
        1997
        >>> test4.refmonth = 'November'
        >>> oct.wateryear
        1996
        >>> nov.wateryear
        1997

    Note that |Date| objects are mutable.  Use the `copy` method to prevent
    from unintentional results:

        >>> date1 = Date('1996.11.01 00:00')
        >>> date2 = date1
        >>> date3 = date1.copy()
        >>> date1.year = 1997
        >>> for date in (date1, date2, date3):
        ...     print(date)
        1997.11.01 00:00:00
        1997.11.01 00:00:00
        1996.11.01 00:00:00
    """

    # These are the so far accepted date format strings.
    _formatstrings = {'os': '%Y_%m_%d_%H_%M_%S',
                      'iso': '%Y.%m.%d %H:%M:%S',
                      'din': '%d.%m.%Y %H:%M:%S'}
    # The first month of the hydrological year (e.g. November in Germany)
    _firstmonth_wateryear = 11

    def __init__(self, date):
        self.datetime = None
        self._style = None
        if isinstance(date, abctools.DateABC):
            self.datetime = date.datetime
        elif isinstance(date, datetime.datetime):
            if date.microsecond:
                raise ValueError('For `Date` instances, the microsecond must '
                                 'be `0`.  For the given `datetime` object, '
                                 'it is `%d` instead.' % date.microsecond)
            self.datetime = date
        elif isinstance(date, str):
            self._initfromstr(date)
        elif isinstance(date, abctools.TOYABC):
            self.datetime = datetime.datetime(2000,
                                              date.month, date.day, date.hour,
                                              date.minute, date.second)
        else:
            raise TypeError('The supplied argument must be either an '
                            'instance of `datetime.datetime` or of `str`.  '
                            'The given arguments type is %s.' % type(date))

    def _initfromstr(self, date):
        """Try to initialize `datetime` from the given |str| instance.

        Arguments:
            * date (|str|): Initialization date.
        """
        for (style, string) in self._formatstrings.items():
            for dummy in range(4):
                try:
                    self.datetime = datetime.datetime.strptime(date, string)
                    self._style = style
                except ValueError:
                    string = string[:-3]
        if self.datetime is None:
            raise ValueError('Date could not be identified out of the given '
                             'string %s.  The available formats are %s.'
                             % (date, self._formatstrings))

    @classmethod
    def fromarray(cls, array):
        """Returns a |Date| instance based on date information (year,
        month, day, hour, minute, second) stored as the first entries of
        the successive rows of a |numpy.ndarray| object."""
        intarray = numpy.array(array, dtype=int)
        for dummy in range(1, array.ndim):
            intarray = intarray[:, 0]
        return cls(datetime.datetime(*intarray))

    def toarray(self):
        """Returns a 1-dimensional |numpy| |numpy.ndarray| with six entries
        defining the actual date (year, month, day, hour, minute, second)."""
        return numpy.array([self.year, self.month, self.day, self.hour,
                            self.minute, self.second], dtype=float)

    def _getrefmonth(self):
        """First month of the hydrological year. The default value is 11
        (November which is the german reference month). Setting it e.g. to 10
        (October is another common reference month many different countries)
        affects all |Date| instances."""
        return type(self)._firstmonth_wateryear

    def _setrefmonth(self, value):
        try:
            type(self)._firstmonth_wateryear = int(value)
        except ValueError:
            string = str(value)[:3].lower()
            try:
                months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun',
                          'jul', 'aug', 'sew', 'oct', 'nov', 'dec']
                type(self)._firstmonth_wateryear = months.index(string) + 1
            except ValueError:
                raise ValueError('The given value `%s` cannot be interpreted '
                                 'as a month. Supply e.g. a number between 1 '
                                 'and 12 or a month name instead.' % value)

    refmonth = property(_getrefmonth, _setrefmonth)

    def _getstyle(self):
        """Date format style to be applied in printing."""
        if self._style is None:
            return 'iso'
        return self._style

    def _setstyle(self, style):
        if style in self._formatstrings:
            self._style = style
        else:
            self._style = None
            raise KeyError('Date format style `%s` is not available.' % style)

    style = property(_getstyle, _setstyle)

    def _setthing(self, thing, value):
        """Convenience method for `_setyear`, `_setmonth`..."""
        try:
            value = int(value)
        except (TypeError, ValueError):
            raise ValueError('Changing the %s of a `Date` instance is only '
                             'allowed via numbers, but the given value `%s` '
                             'is of type `%s` instead.'
                             % (thing, value, type(value)))
        kwargs = {}
        for unit in ('year', 'month', 'day', 'hour', 'minute', 'second'):
            kwargs[unit] = getattr(self, unit)
        kwargs[thing] = value
        self.datetime = datetime.datetime(**kwargs)

    def _getsecond(self):
        """The actual second."""
        return self.datetime.second

    def _setsecond(self, second):
        self._setthing('second', second)

    second = property(_getsecond, _setsecond)

    def _getminute(self):
        """The actual minute."""
        return self.datetime.minute

    def _setminute(self, minute):
        self._setthing('minute', minute)

    minute = property(_getminute, _setminute)

    def _gethour(self):
        """The actual hour."""
        return self.datetime.hour

    def _sethour(self, hour):
        self._setthing('hour', hour)

    hour = property(_gethour, _sethour)

    def _getday(self):
        """The actual day."""
        return self.datetime.day

    def _setday(self, day):
        self._setthing('day', day)

    day = property(_getday, _setday)

    def _getmonth(self):
        """The actual month."""
        return self.datetime.month

    def _setmonth(self, month):
        self._setthing('month', month)

    month = property(_getmonth, _setmonth)

    def _getyear(self):
        """The actual year."""
        return self.datetime.year

    def _setyear(self, year):
        self._setthing('year', year)

    year = property(_getyear, _setyear)

    @property
    def wateryear(self):
        """The actual hydrological year according selected reference month."""
        if self.month < self._firstmonth_wateryear:
            return self.year
        return self.year + 1

    @property
    def dayofyear(self):
        """Day of year as an integer value."""
        return self.datetime.timetuple().tm_yday

    @property
    def leapyear(self):
        """Return whether the actual date falls in a leap year or not."""
        year = self.year
        return (((year % 4) == 0) and
                (((year % 100) != 0) or ((year % 400) == 0)))

    def copy(self):
        """Returns a deep copy of the |Date| instance."""
        return copy.deepcopy(self)

    def __add__(self, other):
        new = Date(self.datetime + Period(other).timedelta)
        new.style = self.style
        return new

    def __iadd__(self, other):
        self.datetime += Period(other).timedelta
        return self

    def __sub__(self, other):
        try:
            return Period(self.datetime-Date(other).datetime)
        except (TypeError, ValueError):
            try:
                new = Date(self.datetime-Period(other).timedelta)
                new.style = self.style
                return new
            except (TypeError, ValueError):
                raise Exception('Object `%s` of type `%s` can not be '
                                'substracted from a `Date` instance.'
                                % (str(other), type(other)))

    def __isub__(self, other):
        self.datetime -= Period(other).timedelta
        return self

    def __lt__(self, other):
        return self.datetime < Date(other).datetime

    def __le__(self, other):
        return self.datetime <= Date(other).datetime

    def __eq__(self, other):
        return self.datetime == Date(other).datetime

    def __ne__(self, other):
        return self.datetime != Date(other).datetime

    def __gt__(self, other):
        return self.datetime > Date(other).datetime

    def __ge__(self, other):
        return self.datetime >= Date(other).datetime

    def string(self, style):
        """Returns a |str| object representing the actual date in
        accordance with the given style.
        """
        retain = self.style
        try:
            self.style = style
            return str(self)
        finally:
            self.style = retain

    def __str__(self):
        return self.datetime.strftime(self._formatstrings[self.style])

    def __repr__(self):
        return "Date('%s')" % str(self)

    def __dir__(self):
        return objecttools.dir_(self)


abctools.DateABC.register(Date)


class Period(object):
    """Handles the length of a single time period.

    Class |Period| is build on top of the Python module |datetime|.
    In essence, it wraps the |datetime| class |datetime.timedelta| and
    is supposed to specialise this general classes on the needs of HydPy
    users.

    Be aware of the different minimum time resolution of module |datetime|
    (microseconds) and module |timetools| (seconds).

    |Period| objects can be directly initialized via |datetime.timedelta|
    objects, e.g.:

        >>> from datetime import timedelta
        >>> from hydpy import Period
        >>> # Initialize a `timedelta` object...
        >>> timedelta_object = timedelta(1, 0)
        >>> # ...and use it to initialise a `Period` object
        >>> period = Period(timedelta_object)

    Alternatively, one can initialize from |str| objects.  These must
    consist of some characters defining an integer value directly followed
    by a single character defining the unit:

        >>> # 30 seconds:
        >>> period = Period('30s')
        >>> # 5 minutes:
        >>> period = Period('5m')
        >>> # 6 hours:
        >>> period = Period('6h')
        >>> # 1 day:
        >>> period = Period('1d')

    In case you need an "empty" period object, just pass nothing or |None|:

        >>> Period()
        Period()
        >>> Period(None)
        Period()

    |Period| always determines the unit leading to the most legigible
    expression:

        >>> # Print using the unit leading to the smallest integer value:
        >>> print(period)
        1d
        >>> # Alternatively, the values of all time units are directly
        >>> # available as `float` objects:
        >>> period.days
        1.0
        >>> period.hours
        24.0
        >>> period.minutes
        1440.0
        >>> period.seconds
        86400.0

    If considered useful, logic and arithmetic operations are supported.
    Some examples:

        >>> # Determine the period length between two dates.
        >>> from hydpy import Date
        >>> date1, date2 = Date('1997.11.01'), Date('1996.11.01')
        >>> wholeperiod = date1 - date2
        >>> print(wholeperiod)
        365d
        >>> # Determine, how often one period fits into the other.
        >>> wholeperiod / period
        365.0
        >>> # Get one sixths of period:
        >>> period / 6
        Period('4h')
        >>> # But when trying to get one seventh of period, the following
        >>> # error is raised:
        >>> period / 7
        Traceback (most recent call last):
        ...
        ValueError: For `Period` instances, microseconds must be zero.  \
However, for the given `timedelta` object, it is`857142` instead.

        >>> # Double a period duration.
        >>> period *= 2
        >>> period
        Period('2d')
        >>> # Shift a date.
        >>> date1 - period
        Date('1997.10.30 00:00:00')
        >>> # Note that the modulo operator returns a boolean value, indicating
        >>> # whether division results in a remainder or not:
        >>> Period('1d') % Period('12h')
        False
        >>> Period('1d') % Period('13h')
        True
        >>> # Following the same line of thinking, floor division leads to the
        >>> # opposite results:
        >>> Period('1d') // Period('12h')
        True
        >>> Period('1d') // Period('13h')
        False
        >>> # Compare dates or periods.
        >>> date1 < date2
        False
        >>> min(date1, date2)
        Date('1996.11.01 00:00:00')
        >>> period == wholeperiod
        False
        >>> # Operations on initialisation arguments are supported.
        >>> date1 + '5m'
        Date('1997.11.01 00:05:00')
        >>> period != '12h'
        True

    Note that |Period| objects are mutable.  Use the `copy` method to
    prevent from unintentional results::

        >>> period1 = Period('6h')
        >>> period2 = period1
        >>> period3 = period1.copy()
        >>> period1 -= '2h'
        >>> period1, period2, period3
        (Period('4h'), Period('4h'), Period('6h'))
    """
    def __init__(self, period=None):
        self._timedelta = None
        self.timedelta = period
        self._unit = None

    def _get_timedelta(self):
        if self._timedelta is None:
            raise AttributeError(
                'The Period object does not contain a timedelta object '
                '(eventually, it has been initialized without an argument).')
        else:
            return self._timedelta

    def _set_timedelta(self, period):
        if period is None:
            self._timedelta = None
        elif isinstance(period, abctools.PeriodABC):
            self._timedelta = getattr(period, 'timedelta', None)
        elif isinstance(period, datetime.timedelta):
            if period.microseconds:
                raise ValueError(
                    'For `Period` instances, microseconds must be zero.  '
                    'However, for the given `timedelta` object, it is'
                    '`%d` instead.' % period.microseconds)
            self._timedelta = period
        elif isinstance(period, str):
            self._initfromstr(period)
        else:
            raise ValueError(
                'The supplied argument must be either an '
                'instance of `datetime.timedelta` or `str`.  '
                'The given arguments type is %s.'
                % objecttools.classname(period))

    def _del_timedelta(self):
        self._timedelta = None

    timedelta = property(_get_timedelta, _set_timedelta, _del_timedelta)

    def _initfromstr(self, period):
        """Try to initialize `timedelta` from the given |str| instance.

        Arguments:
            * period (|str|): Period length.
         """
        try:
            number = int(period[:-1])
        except ValueError:
            raise ValueError(
                'All characters of the given period string, '
                'except the last one which represents the unit, '
                'need to define a whole decimal number.  Instead,'
                ' these characters are `%s`.'
                % period[:-1])
        self._unit = period[-1]
        if self._unit not in ('d', 'h', 'm', 's'):
            raise ValueError(
                'The last character of the given period string '
                'needs to be either `d` (days), `h` (hours) or '
                '`m` (minutes).  Instead, the last character is `%s`.'
                % self._unit)
        if self._unit == 'd':
            self._timedelta = datetime.timedelta(number, 0)
        elif self._unit == 'h':
            self._timedelta = datetime.timedelta(0, number*3600)
        elif self._unit == 'm':
            self._timedelta = datetime.timedelta(0, number*60)
        elif self._unit == 's':
            self._timedelta = datetime.timedelta(0, number)

    @classmethod
    def fromseconds(cls, seconds):
        """Return a |Period| instance based on a given number of seconds."""
        try:
            seconds = int(seconds)
        except TypeError:
            seconds = int(seconds.flatten()[0])
        return cls(datetime.timedelta(0, int(seconds)))

    def _guessunit(self):
        """Guess the unit of the period as the largest one, which results in
        an integer duration.
        """
        if not self.days % 1:
            return 'd'
        elif not self.hours % 1:
            return 'h'
        elif not self.minutes % 1:
            return 'm'
        elif not self.seconds % 1:
            return 's'
        else:
            raise ValueError('The stepsize is not a multiple of one '
                             'second, which is not allowed.')

    unit = property(_guessunit)

    def _getseconds(self):
        """Period length in seconds."""
        return self.timedelta.total_seconds()

    seconds = property(_getseconds)

    def _getminutes(self):
        """Period length in minutes."""
        return self.seconds / 60

    minutes = property(_getminutes)

    def _gethours(self):
        """Period length in hours."""
        return self.minutes / 60

    hours = property(_gethours)

    def _getdays(self):
        """Period length in days."""
        return self.hours / 24

    days = property(_getdays)

    def copy(self):
        """Returns a deep copy of the |Period| instance."""
        return copy.deepcopy(self)

    def __bool__(self):
        return self._timedelta is not None

    def __nonzero__(self):
        return self.__bool__()

    def __add__(self, other):
        try:
            new = Date(Date(other).datetime + self.timedelta)
            new.style = other.style
            return new
        except (TypeError, ValueError):
            try:
                return Period(self.timedelta + Period(other).timedelta)
            except (TypeError, ValueError):
                raise Exception('Object `%s` of type `%s` can not be '
                                'added to a `Period` instance.'
                                % (str(other), type(other)))

    def __iadd__(self, other):
        self.timedelta += Period(other).timedelta
        return self

    def __sub__(self, other):
        return Period(self.timedelta - Period(other).timedelta)

    def __isub__(self, other):
        self.timedelta -= Period(other).timedelta
        return self

    def __mul__(self, value):
        return Period(self.timedelta * value)

    def __rmul__(self, value):
        return self * value

    def __imul__(self, value):
        self.timedelta *= value
        return self

    def __truediv__(self, other):
        if isinstance(other, numbers.Integral):
            return Period(self.timedelta // other)
        return self.seconds / Period(other).seconds

    def __itruediv__(self, value):
        return self / value

    def __mod__(self, other):
        return (self.seconds % Period(other).seconds) != 0.

    def __floordiv__(self, other):
        return (self.seconds % Period(other).seconds) == 0.

    def __lt__(self, other):
        return self.timedelta < Period(other).timedelta

    def __le__(self, other):
        return self.timedelta <= Period(other).timedelta

    def __eq__(self, other):
        return self.timedelta == Period(other).timedelta

    def __ne__(self, other):
        return self.timedelta != Period(other).timedelta

    def __gt__(self, other):
        return self.timedelta > Period(other).timedelta

    def __ge__(self, other):
        return self.timedelta >= Period(other).timedelta

    def __str__(self):
        if not self:
            return '?'
        if self.unit == 'd':
            return '%dd' % self.days
        elif self.unit == 'h':
            return '%dh' % self.hours
        elif self.unit == 'm':
            return '%dm' % self.minutes
        elif self.unit == 's':
            return '%ds' % self.seconds

    def __repr__(self):
        if self:
            return "Period('%s')" % str(self)
        return 'Period()'

    def __dir__(self):
        return objecttools.dir_(self)


abctools.PeriodABC.register(Period)


class Timegrid(object):
    """Handle a time period defined by to dates and a step size in between.

    In hydrological modelling, input (and output) data are usually only
    available with a certain resolution, which also determines the possible
    resolution of the actual simulation.  This is reflected by the class
    |Timegrid|, which represents the first and the last date of e.g.
    a simulation period as well as the intermediate dates. A |Timegrid|
    object is initialized by defining its first date, its last date and its
    stepsize:

        >>> from hydpy import Date, Period, Timegrid
        >>> # Either pass the proper attributes directly...
        >>> firstdate = Date('1996.11.01')
        >>> lastdate = Date('1997.11.01')
        >>> stepsize = Period('1d')
        >>> timegrid_sim = Timegrid(firstdate, lastdate, stepsize)
        >>> timegrid_sim
        Timegrid('1996.11.01 00:00:00',
                 '1997.11.01 00:00:00',
                 '1d')
        >>> # ...or pass their initialization arguments:
        >>> timegrid_sim = Timegrid('1996.11.01', '1997.11.01', '1d')
        >>> timegrid_sim
        Timegrid('1996.11.01 00:00:00',
                 '1997.11.01 00:00:00',
                 '1d')

    |Timegrid| provides functionalities to ease and secure the handling
    of dates in HydPy. Here some examples:

        >>> # Retrieve a date via indexing, e.g. the second one:
        >>> date = timegrid_sim[1]
        >>> date
        Date('1996.11.02 00:00:00')
        >>> # Or the other way round, retrieve the index belonging to a date:
        >>> timegrid_sim[date]
        1
        >>> # Indexing beyond the ranges of the actual time period is allowed:
        >>> timegrid_sim[-366]
        Date('1995.11.01 00:00:00')
        >>> timegrid_sim[timegrid_sim[date+'365d']]
        Date('1997.11.02 00:00:00')
        >>> # Iterate through all time grid points (e.g. to print the first
        >>> # day of each month):
        >>> for date in timegrid_sim:
        ...     if date.day == 1:
        ...         print(date)
        1996.11.01 00:00:00
        1996.12.01 00:00:00
        1997.01.01 00:00:00
        1997.02.01 00:00:00
        1997.03.01 00:00:00
        1997.04.01 00:00:00
        1997.05.01 00:00:00
        1997.06.01 00:00:00
        1997.07.01 00:00:00
        1997.08.01 00:00:00
        1997.09.01 00:00:00
        1997.10.01 00:00:00

    After doing some changes one should call the |Timegrid.verify|
    method:

        >>> # `verify` keeps silent if everything seems to be alright...
        >>> timegrid_sim.verify()
        >>> # ...but raises an suitable exception otherwise:
        >>> timegrid_sim.firstdate.minute = 30
        >>> timegrid_sim.verify()
        Traceback (most recent call last):
        ...
        ValueError: Unplausible timegrid. The period span between the given \
dates 1996.11.01 00:30:00 and 1997.11.01 00:00:00 is not a multiple of the \
given step size 1d.

    One can check two |Timegrid| instances for equality:

        >>> # Make a deep copy of the timegrid already existing.
        >>> timegrid_test = timegrid_sim.copy()
        >>> # Test for equality and non-equality.
        >>> timegrid_sim == timegrid_test
        True
        >>> timegrid_sim != timegrid_test
        False
        >>> # Modify one date of the new timegrid.
        >>> timegrid_test.firstdate += '1d'
        >>> # Again, test for equality and non-equality.
        >>> timegrid_sim == timegrid_test
        False
        >>> timegrid_sim != timegrid_test
        True

    Also, one can check if a date or even the whole timegrid lies within a
    span defined by a |Timegrid| instance::

        >>> # Define a long timegrid:
        >>> timegrid_long = Timegrid('1996.11.01', '2006.11.01', '1d')
        >>> # Check different dates for lying in the defined time period:
        >>> '1996.10.31' in timegrid_long
        False
        >>> '1996.11.01' in timegrid_long
        True
        >>> '1996.11.02' in timegrid_long
        True
        >>> # For dates not alligned on the grid `False` is returned:
        >>> '1996.11.01 12:00' in timegrid_long
        False

        >>> # Now define a timegrid containing only the first year of the
        >>> # long one:
        >>> timegrid_short = Timegrid('1996.11.01', '1997.11.01', '1d')
        >>> # Check which timegrid is contained by the other:
        >>> timegrid_short in timegrid_long
        True
        >>> timegrid_long in timegrid_short
        False
        >>> # For timegrids with different stepsizes `False` is returned:
        >>> timegrid_short.stepsize = Period('1h')
        >>> timegrid_short in timegrid_long
        False
    """
    _firstdate = None
    _lastdate = None
    _stepsize = None

    def __init__(self, firstdate, lastdate, stepsize):
        self.firstdate = firstdate
        self.lastdate = lastdate
        self.stepsize = stepsize
        self.verify()

    def _getfirstdate(self):
        return self._firstdate

    def _setfirstdate(self, firstdate):
        self._firstdate = Date(firstdate)

    firstdate = property(_getfirstdate, _setfirstdate)

    def _getlastdate(self):
        return self._lastdate

    def _setlastdate(self, lastdate):
        self._lastdate = Date(lastdate)

    lastdate = property(_getlastdate, _setlastdate)

    def _getstepsize(self):
        return self._stepsize

    def _setstepsize(self, stepsize):
        self._stepsize = Period(stepsize)

    stepsize = property(_getstepsize, _setstepsize)

    @classmethod
    def fromarray(cls, array):
        """Returns a |Timegrid| instance based on two date and one period
        information stored in the first 13 rows of a |numpy.ndarray| object.
        """
        try:
            return cls(firstdate=Date.fromarray(array[:6]),
                       lastdate=Date.fromarray(array[6:12]),
                       stepsize=Period.fromseconds(array[12]))
        except IndexError:
            raise IndexError('To define a Timegrid instance via an array, 13 '
                             'numbers are required.  However, the given array '
                             'consist of %d entries/rows only.' % len(array))

    def toarray(self):
        """Returns a 1-dimensional |numpy| |numpy.ndarray| with thirteen
        entries first defining the start date, secondly defining the end
        date and thirdly the step size in seconds.
        """

        values = numpy.empty(13, dtype=float)
        values[:6] = self.firstdate.toarray()
        values[6:12] = self.lastdate.toarray()
        values[12] = self.stepsize.seconds
        return values

    def array2series(self, array):
        """Prefix the information of the actual Timegrid object to the given
        array and return it.

        The Timegrid information is stored in the first thirteen values of
        the first axis of the returned series.  Initialize a Timegrid object
        and apply its `array2series` method on a simple list containing
        numbers:

        >>> from hydpy import Timegrid
        >>> timegrid = Timegrid('2000.11.01 00:00', '2000.11.01 04:00', '1h')
        >>> series = timegrid.array2series([1, 2, 3.5, '5.0'])

        The first six entries contain the first date of the timegrid (year,
        month, day, hour, minute, second):

        >>> from hydpy import round_
        >>> round_(series[:6])
        2000.0, 11.0, 1.0, 0.0, 0.0, 0.0

        The six subsequent entries contain the last date:

        >>> round_(series[6:12])
        2000.0, 11.0, 1.0, 4.0, 0.0, 0.0

        The thirteens value is the step size in seconds:

        >>> round_(series[12])
        3600.0

        The last four value are the ones of the given vector:

        >>> round_(series[-4:])
        1.0, 2.0, 3.5, 5.0

        The given array can have an arbitrary number of dimensions:

        >>> import numpy
        >>> array = numpy.eye(4)
        >>> series = timegrid.array2series(array)

        Now the timegrid information is stored in the first column:

        >>> round_(series[:13, 0])
        2000.0, 11.0, 1.0, 0.0, 0.0, 0.0, 2000.0, 11.0, 1.0, 4.0, 0.0, 0.0, \
3600.0

        All other columns of the first thirteen rows contain nan values, e.g.:

        >>> round_(series[12, :])
        3600.0, nan, nan, nan

        The original values are stored in the last four rows, e.g.:

        >>> round_(series[13, :])
        1.0, 0.0, 0.0, 0.0

        Inappropriate array objects result in error messages like:

        >>> timegrid.array2series([[1, 2], [3]])
        Traceback (most recent call last):
        ...
        ValueError: While trying to prefix timegrid information to the given \
array, the following error occured: setting an array element with a sequence.

        If the given array does not fit to the defined timegrid, a special
        error message is returned:

        >>> timegrid.array2series([[1, 2], [3, 4]])
        Traceback (most recent call last):
        ...
        ValueError: When converting an array to a sequence, the lengths of \
the timegrid and the given array must be equal, but the length of the \
timegrid object is `4` and the length of the array object is `2`.
        """
        try:
            array = numpy.array(array, dtype=float)
        except BaseException:
            objecttools.augment_excmessage('While trying to prefix timegrid '
                                           'information to the given array')
        if len(array) != len(self):
            raise ValueError(
                'When converting an array to a sequence, the lengths of the '
                'timegrid and the given array must be equal, but the length '
                'of the timegrid object is `%s` and the length of the array '
                'object is `%s`.' % (len(self), len(array)))
        shape = list(array.shape)
        shape[0] += 13
        series = numpy.full(shape, numpy.nan)
        slices = [slice(0, 13)]
        subshape = [13]
        for dummy in range(1, series.ndim):
            slices.append(slice(0, 1))
            subshape.append(1)
        series[slices] = self.toarray().reshape(subshape)
        series[13:] = array
        return series

    def verify(self):
        """Raise an |ValueError| if the dates or the step size of the time
        frame are inconsistent.
        """
        if self.firstdate >= self.lastdate:
            raise ValueError('Unplausible timegrid. The first given '
                             'date %s, the second given date is %s. '
                             % (self.firstdate, self.lastdate))
        if (self.lastdate-self.firstdate) % self.stepsize:
            raise ValueError('Unplausible timegrid. The period span '
                             'between the given dates %s and %s is not '
                             'a multiple of the given step size %s.' %
                             (self.firstdate, self.lastdate, self.stepsize))

    def copy(self):
        """Returns a deep copy of the |Timegrid| instance."""
        return copy.deepcopy(self)

    def __len__(self):
        return abs(int((self.lastdate-self.firstdate) / self.stepsize))

    def __getitem__(self, key):
        if isinstance(key, numbers.Integral):
            return Date(self.firstdate + key*self.stepsize)
        else:
            key = Date(key)
            index = (key-self.firstdate) / self.stepsize
            if index % 1.:
                raise ValueError('The given date `%s` is not properly '
                                 'alligned on the indexed timegrid.' % key)
            else:
                return int(index)

    def __iter__(self):
        date = self.firstdate.copy()
        while date < self.lastdate:
            yield date
            date = date + self.stepsize

    def _containsdate(self, date):
        date = Date(date)
        return ((self.firstdate <= date <= self.lastdate) and
                ((date-self.firstdate) // self.stepsize))

    def _containstimegrid(self, timegrid):
        return (self._containsdate(timegrid.firstdate) and
                self._containsdate(timegrid.lastdate) and
                (timegrid.stepsize == self.stepsize))

    def __contains__(self, other):
        if isinstance(other, abctools.TimegridABC):
            return self._containstimegrid(other)
        return self._containsdate(other)

    def __eq__(self, other):
        return ((self.firstdate == other.firstdate) and
                (self.lastdate == other.lastdate) and
                (self.stepsize == other.stepsize))

    def __ne__(self, other):
        return ((self.firstdate != other.firstdate) or
                (self.lastdate != other.lastdate) or
                (self.stepsize != other.stepsize))

    def __str__(self):
        return ('from %s to %s in %s steps'
                % (self.firstdate, self.lastdate, self.stepsize))

    def __repr__(self):
        return self.assignrepr('')

    def assignrepr(self, prefix):
        """Return a |repr| string with an prefixed assignement.

        Argument:
            * prefix(|str|): Usually something like 'x = '.
        """
        skip = len(prefix) + 9
        blanks = ' ' * skip
        lines = ["%sTimegrid('%s'," % (prefix, str(self.firstdate)),
                 "%s'%s'," % (blanks, str(self.lastdate)),
                 "%s'%s')" % (blanks, str(self.stepsize))]
        return '\n'.join(lines)

    def __dir__(self):
        return objecttools.dir_(self)


abctools.TimegridABC.register(Timegrid)


class Timegrids(object):
    """Handles all |Timegrid| instances of a HydPy project.

    The HydPy framework distinguishes three `time frames`, one associated
    with the input date available on disk (`data`), one associated, with the
    initialisation period (`init`), and one associated with the actual
    simulation period (`sim`).  The last two latter time frames are
    represented by two different |Timegrid| objects, which are both
    handled by a single |Timegrids| object.  (The `data` time frames
    are also defined via |Timegrid| objects, but for each input data
    file separately. See module |sequencetools| for further information.)

    There is usually only one |Timegrids| object required within each
    HydPy project.  Usually It is instantiated in the project's main file
    or at the top of script defining a HydPy workflow and assigned to the
    |pub| module, which provides access to "global" project settings:

        >>> from hydpy import Timegrid, Timegrids
        >>> from hydpy import pub

    In many cases, one want to perform the simulation over the whole
    initialization period.  Then only one Timegrid instance must be
    defined:

        >>> pub.timegrids = Timegrids(Timegrid('2000.11.11',
        ...                                    '2003.11.11',
        ...                                     '1d'))
        >>> pub.timegrids
        Timegrids(Timegrid('2000.11.11 00:00:00',
                           '2003.11.11 00:00:00',
                           '1d'))

    Otherwise, two Timegrid instances must be given:

        >>> pub.timegrids = Timegrids(init=Timegrid('2000.11.11',
        ...                                         '2003.11.11',
        ...                                         '1h'),
        ...                           sim=Timegrid('2001.11.11',
        ...                                        '2002.11.11',
        ...                                        '1h'))
        >>> pub.timegrids
        Timegrids(init=Timegrid('2000.11.11 00:00:00',
                                '2003.11.11 00:00:00',
                                '1h'),
                  sim=Timegrid('2001.11.11 00:00:00',
                               '2002.11.11 00:00:00',
                               '1h'))

    Some examples on the usage of this |Timegrids| instance:

        >>> # Get the general data and simulation step size:
        >>> pub.timegrids.stepsize
        Period('1h')
        >>> # Get the factor to convert `mm/stepsize` to m^3/s for an area
        >>> # of 36 km^2:
        >>> pub.timegrids.qfactor(36.)
        10.0
        >>> # Get the index of the first values of the `initialization frame`
        >>> # which belong to the `simulation frame`.
        >>> pub.timegrids.init[pub.timegrids.sim.firstdate]
        8760

    Each manual change should be followed by calling the
    |Timegrids.verify| method, which calls the |Timegrid.verify|
    method of the single |Timegrid| instances and performs some
    additional tests:

        >>> # To postpone the end of the `simulation time frame` exactly
        >>> # one year is fine:
        >>> pub.timegrids.sim.lastdate += '365d'
        >>> pub.timegrids.verify()
        >>> # But any additional day shifts it outside the `initialisation
        >>> # time frame`, so verification raises a value error:
        >>> pub.timegrids.sim.lastdate += '1d'
        >>> pub.timegrids.verify()
        Traceback (most recent call last):
        ...
        ValueError: The last date of the initialisation period \
(2003.11.11 00:00:00) must not be earlier than the last date of the \
simulation period (2003.11.12 00:00:00).
        >>> pub.timegrids.sim.lastdate -= '1d'

        >>> # The other boundary is also checked:
        >>> pub.timegrids.sim.firstdate -= '366d'
        >>> pub.timegrids.verify()
        Traceback (most recent call last):
        ...
        ValueError: The first date of the initialisation period \
(2000.11.11 00:00:00) must not be later than the first date of the \
simulation period (2000.11.10 00:00:00).

        >>> # Both timegrids are checked to have the same step size:
        >>> pub.timegrids.sim = Timegrid('2001.11.11',
        ...                              '2002.11.11',
        ...                              '1d')
        >>> pub.timegrids.verify()
        Traceback (most recent call last):
        ...
        ValueError: The initialization stepsize (1h) must be identical \
with the simulation stepsize (1d).

        >>> # Also, they are checked to be properly aligned:
        >>> pub.timegrids.sim = Timegrid('2001.11.11 00:30',
        ...                              '2002.11.11 00:30',
        ...                              '1h')
        >>> pub.timegrids.verify()
        Traceback (most recent call last):
        ...
        ValueError: The simulation time grid is not properly alligned \
on the initialization time grid.
    """
    def __init__(self, init, sim=None, data=None):
        if data is not None:
            warnings.warn(objecttools.HydPyDeprecationWarning(
                'The global `data` timegrid information is outdated.  Now '
                'each time series file contains its own `data` timegrid.  '
                'Supplying the `data` keyword to the `Timegrids` constructor '
                'does nothing and will be banned in the future.'))
        self.init = init
        if sim is None:
            self.sim = self.init.copy()
        else:
            self.sim = sim
        self.verify()

    def _getstepsize(self):
        """Stepsize of all handled |Timegrid| objects."""
        return self.init.stepsize

    def _setstepsize(self, stepsize):
        stepsize = Period(stepsize)
        for (dummy, timegrid) in self:
            timegrid.stepsize = stepsize

    stepsize = property(_getstepsize, _setstepsize)

    def verify(self):
        """Raise an |ValueError| it the different time grids are
        inconsistent."""
        self.init.verify()
        self.sim.verify()
        if self.init.firstdate > self.sim.firstdate:
            raise ValueError('The first date of the initialisation period '
                             '(%s) must not be later than the first date '
                             'of the simulation period (%s).'
                             % (self.init.firstdate, self.sim.firstdate))
        elif self.init.lastdate < self.sim.lastdate:
            raise ValueError('The last date of the initialisation period '
                             '(%s) must not be earlier than the last date '
                             'of the simulation period (%s).'
                             % (self.init.lastdate, self.sim.lastdate))
        elif self.init.stepsize != self.sim.stepsize:
            raise ValueError('The initialization stepsize (%s) must be '
                             'identical with the simulation stepsize (%s).'
                             % (self.init.stepsize, self.sim.stepsize))
        else:
            try:
                self.init[self.sim.firstdate]
            except ValueError:
                raise ValueError('The simulation time grid is not properly '
                                 'alligned on the initialization time grid.')

    def qfactor(self, area):
        """Return the factor for converting `mm/stepsize` to `m^3/s`.

        Argument:
            * area (|float|): Reference area, which must be given in
              the unit `km^2`.
        """
        return area * 1000. / self.stepsize.seconds

    def parfactor(self, stepsize):
        """Return the factor for converting parameter to simulation step size.

        Argument:
            * stepsize (|Period| or an suitable initialization argument
              thereof): Time interval, to which the parameter values refer.
        """
        return self.stepsize / Period(stepsize)

    def copy(self):
        """Returns a deep copy of the |Timegrids| instance."""
        return copy.deepcopy(self)

    def __iter__(self):
        for (name, timegrid) in dict(self).items():
            yield (name, timegrid)

    def __str__(self):
        return 'All timegrids of the actual HydPy project.'

    def __repr__(self):
        return self.assignrepr('')

    def assignrepr(self, prefix):
        """Return a |repr| string with an prefixed assignement.

        Argument:
            * prefix(|str|): Usually something like 'x = '.
        """
        caller = 'Timegrids('
        blanks = ' ' * (len(prefix) + len(caller))
        prefix = '%s%s' % (prefix, caller)
        if self.sim != self.init:
            prefix += 'init='
        lines = ['%s,' % self.init.assignrepr(prefix)]
        if self.sim != self.init:
            prefix = '%ssim=' % blanks
            lines.append('%s,' % self.sim.assignrepr(prefix))
        lines[-1] = lines[-1][:-1] + ')'
        return '\n'.join(lines)

    def __dir__(self):
        return objecttools.dir_(self)


abctools.TimegridsABC.register(Timegrids)


class TOY(object):
    """Time of year handler.

    |TOY| objects are used to define certain things that are true for a
    certain time point in each year.  The smallest supported time unit is
    seconds.

    Normally, for initialization a string is passed, defining the month, the
    day, the hour, the minute and the second in the order they are mentioned,
    separated by a single underscore:

    >>> from hydpy.core.timetools import TOY
    >>> t = TOY('3_13_23_33_43')
    >>> t.month
    3
    >>> t.day
    13
    >>> t.hour
    23
    >>> t.minute
    33
    >>> t.second
    43

    If a lower precision is required, one can shorten the string, which
    implicitely sets the omitted property to the lowest possible value:

    >>> TOY('3_13_23_33')
    TOY('3_13_23_33_0')

    The most extreme example would be, to pass not string at all:

    >>> TOY()
    TOY('1_1_0_0_0')

    One can prefix some information to the string, which is usefull when the
    string is to be used as a valid variable name somewhere else:

    >>> TOY('something_3_13_23_33_2')
    TOY('3_13_23_33_2')

    As one can see, the prefixed information is lost in the printed string
    representation.  But a string with a standard prefix is returned through
    applying |str| on |TOY| instances:

    >>> str(TOY('something_3_13_23_33_2'))
    'toy_3_13_23_33_2'

    Alternatively, one can use a |Date| object as a initialization argument,
    ommitting the year:

    >>> TOY(Date('2001.02.03 04:05:06'))
    TOY('2_3_4_5_6')

    It is only allowed to modify the mentioned properties, not to define new
    ones:

    >>> t.microsecond = 53
    Traceback (most recent call last):
    ...
    AttributeError: TOY (time of year) objects only allow to set the \
properties month, day, hour, minute, and second, but `microsecond` is given.

    It is allowed to pass objects that can be converted to integers:

    >>> t.second = '53'
    >>> t.second
    53

    If the passed object cannot be converted properly, an exception is raised:

    >>> t.second = 'fiftythree'
    Traceback (most recent call last):
    ...
    ValueError: For TOY (time of year) objects, all properties must be of \
type `int`, but the value `fiftythree` of type `str` given for property \
`second` cannot be converted to `int`.

    Additionally, given values are checked to lie within a suitable range:

    >>> t.second = 60
    Traceback (most recent call last):
    ...
    ValueError: The value of property `second` of TOY (time of year) \
objects must lie within the range `(0, 59)`, but the given value is `60`.

    Note that the allowed values for `month` and `day` depend on each other,
    which is why the order one defines them might be of importance.  So, if
    January is predefined, one can set day to the 31th:

    >>> t.month = 1
    >>> t.day = 31

    But afterwards one cannot directly change the month to February:

    >>> t.month = 2
    Traceback (most recent call last):
    ...
    ValueError: The value of property `month` of the actual TOY \
(time of year) object must not be the given value `2`, as the day \
has already been set to `31`.

    Hence first set `day` to a smaller value and then change `month`:

    >>> t.day = 28
    >>> t.month = 2

    For February it is important to note, that the 29th is generally
    disallowed:

    >>> t.day = 29
    Traceback (most recent call last):
    ...
    ValueError: The value of property `day` of the actual TOY (time of year) \
object must lie within the range `(1, 28)`, as the month has already been \
set to `2`, but the given value is `29`.

    It is possible to compare two |TOY| instances:

    >>> t1, t2 = TOY('1'), TOY('2')
    >>> (t1 < t1, t1 < t2, t2 < t1)
    (False, True, False)
    >>> (t1 <= t1, t1 <= t2, t2 <= t1)
    (True, True, False)
    >>> (t1 == t1, t1 == t2)
    (True, False)
    >>> (t1 != t1, t1 != t2)
    (False, True)
    >>> (t1 >= t1, t1 >= t2, t2 >= t1)
    (True, False, True)
    >>> (t1 > t1, t1 > t2, t2 > t1)
    (False, False, True)

    Subtracting two |TOY| object gives their time difference in seconds:

    >>> TOY('1_1_0_3_0') - TOY('1_1_0_1_30')
    90

    Instead of negative values, it is always assumed that the first |TOY|
    object lies within the future (eventually within the subsequent year):

    >>> TOY('1_1_0_1_30') - TOY('12_31_23_58_30')
    180
    """
    _PROPERTIES = collections.OrderedDict((('month', (1, 12)),
                                           ('day', (1, 31)),
                                           ('hour', (0, 23)),
                                           ('minute', (0, 59)),
                                           ('second', (0, 59))))
    _STARTDATE = Date('01.01.2000')
    _ENDDATE = Date('01.01.2001')

    def __init__(self, value=''):
        with objecttools.ResetAttrFuncs(self):
            self.month = None
            self.day = None
            self.hour = None
            self.minute = None
            self.second = None
        if isinstance(value, abctools.DateABC):
            for name in self._PROPERTIES.keys():
                self.__dict__[name] = getattr(value, name)
        else:
            values = value.split('_')
            if not values[0].isdigit():
                del values[0]
            for prop in self._PROPERTIES:
                try:
                    setattr(self, prop, values.pop(0))
                except IndexError:
                    if prop in ('month', 'day'):
                        setattr(self, prop, 1)
                    else:
                        setattr(self, prop, 0)
                except ValueError:
                    objecttools.augment_excmessage(
                        'While trying to retrieve the %s for TOY (time of '
                        'year) object based on the string `%s`'
                        % (prop, value))

    def __setattr__(self, name, value):
        if name not in self._PROPERTIES:
            raise AttributeError(
                'TOY (time of year) objects only allow to set the '
                'properties %s, but `%s` is given.'
                % (objecttools.enumeration(self._PROPERTIES.keys()), name))
        try:
            value = int(value)
        except ValueError:
            raise ValueError(
                'For TOY (time of year) objects, all properties must be of '
                'type `int`, but the %s given for property `%s` cannot be '
                'converted to `int`.'
                % (objecttools.value_of_type(value), name))
        if (name == 'day') and (self.month is not None):
            bounds = (1, calendar.monthrange(1999, self.month)[1])
            if not bounds[0] <= value <= bounds[1]:
                raise ValueError(
                    'The value of property `day` of the actual TOY (time of '
                    'year) object must lie within the range `%s`, as the '
                    'month has already been set to `%s`, but the given value '
                    'is `%s`.' % (bounds, self.month, value))
        elif (name == 'month') and (self.day is not None):
            bounds = (1, calendar.monthrange(2000, value)[1])
            if not bounds[0] <= self.day <= bounds[1]:
                raise ValueError(
                    'The value of property `month` of the actual TOY (time of '
                    'year) object must not be the given value `%s`, as the '
                    'day has already been set to `%s`.'
                    % (value, self.day))
        else:
            bounds = self._PROPERTIES[name]
            if not bounds[0] <= value <= bounds[1]:
                raise ValueError(
                    'The value of property `%s` of TOY (time of year) objects '
                    'must lie within the range `%s`, but the given value is '
                    '`%s`.' % (name, bounds, value))
        object.__setattr__(self, name, value)

    @property
    def passed_seconds(self):
        """Amount of time passed in seconds since the beginning of the year.

        In the first example, the year is only one minute and thirty seconds
        old:

        >>> from hydpy.core.timetools import TOY
        >>> TOY('1_1_0_1_30').passed_seconds
        90

        The second example shows that the 29th February is generally included:

        >>> TOY('3').passed_seconds
        5184000
        """
        return int((Date(self).datetime -
                    self._STARTDATE.datetime).total_seconds())

    @property
    def left_seconds(self):
        """Remaining part of the year in seconds.

        In the first example, only one minute and thirty seconds of the year
        remain:

        >>> from hydpy.core.timetools import TOY
        >>> TOY('12_31_23_58_30').left_seconds
        90

        The second example shows that the 29th February is generally included:

        >>> TOY('2').left_seconds
        28944000
        """
        return int((self._ENDDATE.datetime -
                    Date(self).datetime).total_seconds())

    def __lt__(self, other):
        return self.passed_seconds < other.passed_seconds

    def __le__(self, other):
        return self.passed_seconds <= other.passed_seconds

    def __eq__(self, other):
        return self.passed_seconds == other.passed_seconds

    def __ne__(self, other):
        return self.passed_seconds != other.passed_seconds

    def __gt__(self, other):
        return self.passed_seconds > other.passed_seconds

    def __ge__(self, other):
        return self.passed_seconds >= other.passed_seconds

    def __sub__(self, other):
        if self >= other:
            return self.passed_seconds - other.passed_seconds
        return self.passed_seconds + other.left_seconds

    def __hash__(self):
        return hash(str(self))

    def __str__(self):
        return "toy_%s" % '_'.join(str(getattr(self, prop)) for prop
                                   in self._PROPERTIES.keys())

    def __repr__(self):
        return "TOY('%s')" % '_'.join(str(getattr(self, prop)) for prop
                                      in self._PROPERTIES.keys())

    __dir__ = objecttools.dir_


abctools.TOYABC.register(TOY)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/core/variabletools.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
# -*- coding: utf-8 -*-
"""This module implements general features for defining and working with
parameters and sequences.

Features more specific to either parameters or sequences are implemented
in modules |parametertools| and |sequencetools| respectively.
"""
# import...
# ...from standard library
from __future__ import division, print_function
import copy
import textwrap
# ...from site-packages
import numpy
# ...from HydPy
from hydpy import pub
from hydpy.core import abctools
from hydpy.core import autodoctools
from hydpy.core import objecttools


_INT_NAN = -999999
"""Surrogate for `nan`, which is available for floating point values
but not for integer values."""


def trim(self, lower=None, upper=None):
    """Trim the value(s) of a |Variable| instance.

    One can pass the lower and/or the upper boundary as a function
    argument.  Otherwise, boundary values are taken from the class
    attribute `SPAN` of the given |Variable| instance, if available.

    Note that method |trim| works differently on |Variable| instances
    handling values of different types.  For floating point values,

    an actual trimming is performed.  Additionally, a warning message is
    raised if the trimming results in a change in value exceeding the
    threshold value defined by function |tolerance|.  (This warning
    message can be suppressed by setting the related option flag to False.)
    For integer values, instead of a warning an exception is raised.
    """
    span = getattr(self, 'SPAN', (None, None))
    if lower is None:
        lower = span[0]
    if upper is None:
        upper = span[1]
    type_ = getattr(self, 'TYPE', float)
    if type_ is float:
        if self.NDIM == 0:
            _trim_float_0d(self, lower, upper)
        else:
            _trim_float_nd(self, lower, upper)
    elif type_ is int:
        if self.NDIM == 0:
            _trim_int_0d(self, lower, upper)
        else:
            _trim_int_nd(self, lower, upper)
    elif type_ is bool:
        pass
    else:
        raise NotImplementedError(
            'Method `trim` can only be applied on parameters '
            'handling integer or floating point values, but '
            'value type of parameter `%s` is `%s`.'
            % (self.name, objecttools.classname(self.TYPE)))


def _trim_float_0d(self, lower, upper):
    if numpy.isnan(self.value):
        return
    if (lower is None) or numpy.isnan(lower):
        lower = -numpy.inf
    if (upper is None) or numpy.isnan(upper):
        upper = numpy.inf
    if self < lower:
        if (self+tolerance(self)) < (lower-tolerance(lower)):
            if pub.options.warntrim:
                self.warn_trim()
        self.value = lower
    elif self > upper:
        if (self-tolerance(self)) > (upper+tolerance(upper)):
            if pub.options.warntrim:
                self.warn_trim()
        self.value = upper


def _trim_float_nd(self, lower, upper):
    if lower is None:
        lower = -numpy.inf
    lower = numpy.full(self.shape, lower, dtype=float)
    lower[numpy.where(numpy.isnan(lower))] = -numpy.inf
    if upper is None:
        upper = numpy.inf
    upper = numpy.full(self.shape, upper, dtype=float)
    upper[numpy.where(numpy.isnan(upper))] = numpy.inf
    idxs = numpy.where(numpy.isnan(self.values))
    self[idxs] = lower[idxs]
    if numpy.any(self.values < lower) or numpy.any(self.values > upper):
        if (numpy.any((self+tolerance(self)) <
                      (lower-tolerance(lower))) or
                numpy.any((self-tolerance(self)) >
                          (upper+tolerance(upper)))):
            if pub.options.warntrim:
                self.warn_trim()
        self.values = numpy.clip(self.values, lower, upper)
    self[idxs] = numpy.nan


def _trim_int_0d(self, lower, upper):
    if lower is None:
        lower = _INT_NAN
    if upper is None:
        upper = -_INT_NAN
    if (self != _INT_NAN) and ((self < lower) or (self > upper)):
        raise ValueError(
            'The value `%d` of parameter `%s` of element `%s` is not valid.  '
            % (self.value, self.name, objecttools.devicename(self)))


def _trim_int_nd(self, lower, upper):
    if lower is None:
        lower = _INT_NAN
    lower = numpy.full(self.shape, lower, dtype=int)
    if upper is None:
        upper = -_INT_NAN
    upper = numpy.full(self.shape, upper, dtype=int)
    idxs = numpy.where(self.values == _INT_NAN)
    self[idxs] = lower[idxs]
    if numpy.any(self.values < lower) or numpy.any(self.values > upper):
        raise ValueError(
            'At least one value of parameter `%s` of element `%s` is not '
            'valid.' % (self.name, objecttools.devicename(self)))
    self[idxs] = _INT_NAN


def tolerance(values):
    """Return some sort of "numerical accuracy" to be expected for the
    given floating point value (see method |trim|)."""
    return abs(values*1e-15)


def _compare_variables_function_generator(
        method_string, aggregation_func):
    """Return a function that can be used as a comparison method of class
    |Variable|.

    Pass the specific method (e.g. '__eq__') and the corresponding
    operator (e.g. `==`) as strings.  Also pass either |all| or |any|
    for aggregating multiple boolean values.
    """
    def comparison_function(self, other):
        try:
            method = getattr(self.value, method_string)
        except AttributeError:
            # in Python 2.7, `int` (but not `float`) defines
            # `__cmp__` instead of rich comparisons
            method = getattr(float(self.value), method_string)
        try:
            if isinstance(other, abctools.VariableABC):
                result = method(other.value)
            else:
                result = method(other)
            if result is NotImplemented:
                return result
            try:
                return aggregation_func(result)
            except TypeError:
                return result
        except BaseException:
            objecttools.augment_excmessage(
                'While trying to compare variable `{0!r}` of '
                'element `{1}` with object `{2}` of type `{3}`'
                .format(self, objecttools.devicename(self),
                        other, objecttools.classname(other)))
    return comparison_function


class Variable(object):
    """Base class for |Parameter| and |Sequence|.

    This base class Implements special methods for arithmetic calculations,
    comparisons and type conversions.  See the  following exemples on how
    to do math with HydPys parameter and sequence objects.

    The subclasses are required to provide the members `NDIM` (usually a
    class attribute) and `value` (usually a property).  But for testing
    purposes, one can simply add them as instance attributes.

    A few examples for 0-dimensional objects:

    >>> from hydpy.core.variabletools import Variable
    >>> variable = Variable()
    >>> variable.NDIM = 0
    >>> variable.shape = ()
    >>> variable.value = 2.0
    >>> variable + variable
    4.0
    >>> 3.0 - variable
    1.0
    >>> variable /= 2.
    >>> variable
    variable(1.0)

    Similar examples for 1-dimensional objects:

    >>> import numpy
    >>> variable = Variable()
    >>> variable.NDIM = 1
    >>> variable.shape = (3,)
    >>> variable.value = numpy.array([1.0, 2.0, 3.0])
    >>> print(variable + variable)
    [ 2.  4.  6.]
    >>> print(3. - variable)
    [ 2.  1.  0.]
    >>> variable /= 2.
    >>> variable
    variable(0.5, 1.0, 1.5)

    Note that comparisons on |Variable| objects containg multiple
    values return a single boolean only:

    >>> variable.value = numpy.array([1.0, 3.0])
    >>> variable == [0.0, 2.0], variable == [1.0, 2.0], variable == [1.0, 3.0]
    (False, False, True)
    >>> variable != [0.0, 2.0], variable != [1.0, 2.0], variable != [1.0, 3.0]
    (True, True, False)

    While either the `==` or the `!=` operator returns `True` (but not both),
    this must not be the case for the operator pairs `<`and `>=` as well as
    `>` and `<=`:

    >>> variable < 2.0, variable < 3.0, variable < 4.0
    (False, False, True)
    >>> variable <= 2.0, variable <= 3.0, variable <= 4.0
    (False, True, True)
    >>> variable >= 0.0, variable >= 1.0, variable >= 2.0
    (True, True, False)
    >>> variable > 0.0, variable > 1.0, variable > 2.0
    (True, False, False)

    When asking for impossible comparisons, error messages like the following
    are returned:

    >>> variable < [1.0, 2.0, 3.0]   # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    ...
    ValueError: While trying to compare variable `variable(1.0, 3.0)` of \
element `?` with object `[1.0, 2.0, 3.0]` of type `list`, the following \
error occured: operands could not be broadcast together with shapes (2,) (3,)

    >>> variable.NDIM = 0
    >>> variable.value = 1.0
    >>> variable < 'text'   # doctest: +SKIP
    Traceback (most recent call last):
    ...
    TypeError: '<' not supported between instances of 'Variable' and 'str'

    .. testsetup::

        >>> from hydpy import pub
        >>> if pub.pyversion == 2:
        ...    assert variable < 'text'
        ... else:
        ...     try:
        ...         variable < 'text'
        ...     except TypeError:
        ...         pass

    """
    # Subclasses need to define...
    NDIM = None    # ... e.g. as class attribute (int)
    value = None   # ... e.g. as property (float or ndarray of dtype float)
    shape = None   # ... e.g. as property (tuple of values of type int)
    # ...and optionally...
    INIT = None

    NOT_DEEPCOPYABLE_MEMBERS = ()

    @staticmethod
    def _arithmetic_conversion(other):
        try:
            return other.value
        except AttributeError:
            return other

    def _arithmetic_exception(self, verb, other):
        objecttools.augment_excmessage(
            'While trying to %s %s instance `%s` and %s `%s`'
            % (verb, objecttools.classname(self), self.name,
               objecttools.classname(other), other))

    name = property(objecttools.name)

    @property
    def length(self):
        """Total number of all entries of the sequence.

        For 0-dimensional sequences, `length` is always one:

        >>> from hydpy.core.variabletools import Variable
        >>> variable = Variable()
        >>> Variable.NDIM = 0
        >>> variable.length
        1

        For 1-dimensional sequences, it is the vector length:

        >>> Variable.NDIM = 1
        >>> variable.shape = (5,)
        >>> variable.length
        5

        For higher dimensional sequences, the lenghts of the different axes
        of the matrix are multiplied:

        >>> Variable.NDIM = 3
        >>> variable.shape = (2, 1, 4)
        >>> variable.length
        8
        """
        length = 1
        for idx in range(self.NDIM):
            length *= self.shape[idx]
        return length

    def __deepcopy__(self, memo):
        new = type(self)()
        for (key, value) in vars(self).items():
            if key not in self.NOT_DEEPCOPYABLE_MEMBERS:
                setattr(new, key, copy.deepcopy(value, memo))
        if self.NDIM:
            new.shape = self.shape
        new.value = self.value
        return new

    def __add__(self, other):
        try:
            return self.value + self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('add', other)

    def __radd__(self, other):
        return self.__add__(other)

    def __iadd__(self, other):
        self.value = self.__add__(other)
        return self

    def __sub__(self, other):
        try:
            return self.value - self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('subtract', other)

    def __rsub__(self, other):
        try:
            return self._arithmetic_conversion(other) - self.value
        except BaseException:
            self._arithmetic_exception('subtract', other)

    def __isub__(self, other):
        self.value = self.__sub__(other)
        return self

    def __mul__(self, other):
        try:
            return self.value * self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('multiply', other)

    def __rmul__(self, other):
        return self.__mul__(other)

    def __imul__(self, other):
        self.value = self.__mul__(other)
        return self

    def __truediv__(self, other):
        try:
            return self.value / self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('divide', other)

    def __rtruediv__(self, other):
        try:
            return self._arithmetic_conversion(other) / self.value
        except BaseException:
            self._arithmetic_exception('divide', other)

    def __itruediv__(self, other):
        self.value = self.__truediv__(other)
        return self

    def __floordiv__(self, other):
        try:
            return self.value // self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('floor divide', other)

    def __rfloordiv__(self, other):
        try:
            return self._arithmetic_conversion(other) // self.value
        except BaseException:
            self._arithmetic_exception('floor divide', other)

    def __ifloordiv__(self, other):
        self.value = self.__floordiv__(other)
        return self

    def __mod__(self, other):
        try:
            return self.value % self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('mod divide', other)

    def __rmod__(self, other):
        try:
            return self._arithmetic_conversion(other) % self.value
        except BaseException:
            self._arithmetic_exception('mod divide', other)

    def __imod__(self, other):
        self.value = self.__mod__(other)
        return self

    def __pow__(self, other):
        try:
            return self.value**self._arithmetic_conversion(other)
        except BaseException:
            self._arithmetic_exception('exponentiate', other)

    def __rpow__(self, other):
        try:
            return self._arithmetic_conversion(other)**self.value
        except BaseException:
            self._arithmetic_exception('exponentiate', other)

    def __ipow__(self, other):
        self.value = self.__pow__(other)
        return self

    def __neg__(self):
        return -self.value

    def __pos__(self):
        return +self.value

    def __abs__(self):
        return abs(self.value)

    def __invert__(self):
        return 1./self.value

    def __floor__(self):
        return self.value // 1.

    def __ceil__(self):
        return numpy.ceil(self.value)

    def __trunc__(self):
        return numpy.trunc(self.value)

    def __divmod__(self, other):
        return numpy.divmod(self.value, other)

    def __rdivmod__(self, other):
        return numpy.divmod(other, self.value)

    __lt__ = _compare_variables_function_generator('__lt__', numpy.all)
    __le__ = _compare_variables_function_generator('__le__', numpy.all)
    __eq__ = _compare_variables_function_generator('__eq__', numpy.all)
    __ne__ = _compare_variables_function_generator('__ne__', numpy.any)
    __ge__ = _compare_variables_function_generator('__ge__', numpy.all)
    __gt__ = _compare_variables_function_generator('__gt__', numpy.all)

    def _typeconversion(self, type_):
        if not self.NDIM:
            if isinstance(type_, type):
                return type_(self.value)
            else:
                attr = getattr(self.value, type_)
                try:
                    return attr()
                except TypeError:
                    return attr
        else:
            raise TypeError(
                'The %s instance `%s` is %d-dimensional and thus '
                'cannot be converted to a scalar %s value.'
                % (objecttools.classname(self), self.name,
                   self.NDIM, objecttools.classname(type_)))

    def __bool__(self):
        return self._typeconversion(bool)

    def __nonzero__(self):
        return self.__bool__()

    def __float__(self):
        return self._typeconversion(float)

    def __int__(self):
        return self._typeconversion(int)

    @property
    def real(self):
        return self._typeconversion('real')

    @property
    def imag(self):
        return self._typeconversion('imag')

    def conjugate(self):
        return self._typeconversion('conjugate')

    def __complex__(self):
        return numpy.complex(self.value)

    def __round__(self, ndigits=0):
        return numpy.round(self.value, ndigits)

    def commentrepr(self):
        """Returns a list with comments, e.g. for making string
        representations more informative.  When `pub.options.reprcomments`
        is set to |False|, an empty list is returned.
        """
        if pub.options.reprcomments:
            return ['# %s' % line for line in
                    textwrap.wrap(autodoctools.description(self), 78)]
        return []

    def repr_(self, values, islong):
        prefix = '%s(' % self.name
        if self.NDIM == 0:
            string = '%s(%s)' % (self.name, objecttools.repr_(values))
        elif self.NDIM == 1:
            if islong:
                string = objecttools.assignrepr_list(values, prefix, 75) + ')'
            else:
                string = objecttools.assignrepr_values(
                    values, prefix, 75) + ')'
        elif self.NDIM == 2:
            string = objecttools.assignrepr_list2(values, prefix, 75) + ')'
        else:
            raise NotImplementedError(
                '`repr` does not yet support parameters or sequences like `%s`'
                'of element `%s` which handle %d-dimensional matrices.'
                % self.NDIM)
        return '\n'.join(self.commentrepr() + [string])

    def __repr__(self):
        return self.repr_(self.value, False)


abctools.VariableABC.register(Variable)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/cythons/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  

import sys
import importlib

_modulenames = ('pointerutils',
                'annutils',
                'configutils',
                'smoothutils')

for modulename in _modulenames:
    module = importlib.import_module('hydpy.cythons.autogen.'+modulename)
    sys.modules['hydpy.cythons.'+modulename] = module
    locals()[modulename] = module

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/cythons/modelutils.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
# -*- coding: utf-8 -*-
""" This module provides utilities to build and apply cython models."""
# import...
# ...from standard library
from __future__ import division, print_function
import os
import sys
import platform
import shutil
import copy
import inspect
import importlib
import distutils.core
import distutils.extension
# from Cython import Build (the actual import command has been moved to method
# `compile_` of class `Cythonizer` due to PyInstaller incompatibility)

import math
import functools
# ...third party modules
import numpy
# ...from HydPy
from hydpy import pub
from hydpy import cythons
from hydpy.core import autodoctools
from hydpy.core import objecttools
from hydpy.core import parametertools
from hydpy.core import printtools
from hydpy.core import sequencetools


if platform.system().lower() == 'windows':
    dllextension = '.pyd'
    """The dll file extension on the respective system."""
else:
    dllextension = '.so'

_int = 'numpy.'+str(numpy.array([1]).dtype)+'_t'

TYPE2STR = {bool: 'bint',
            int: _int,
            parametertools.IntConstant: _int,
            float: 'double',
            str: 'str',
            None: 'void'}
"""Maps Python types to Cython compatible type declarations.

The Cython type belonging to Python's |int| is selected to be in
agreement with numpy's default integer type on the respective platform/system.
"""

NDIM2STR = {0: '',
            1: '[:]',
            2: '[:,:]',
            3: '[:,:,:]'}

_nogil = ' nogil' if pub.options.fastcython else ''


class Lines(list):
    """Handles lines to be written into a `.pyx` file."""

    def __init__(self, *args):
        list.__init__(self, args)

    def add(self, indent, line):
        """Appends the given text line with prefixed spaces in accordance with
        the given number of indentation levels.
        """
        if isinstance(line, str):
            list.append(self, indent*4*' ' + line)
        else:
            for subline in line:
                list.append(self, indent*4*' ' + subline)

    def __repr__(self):
        return '\n'.join(self) + '\n'


def method_header(method_name, nogil=False, idx_as_arg=False):
    """Returns the Cython method header for methods without arguments except
    `self`."""
    if not pub.options.fastcython:
        nogil = False
    header = 'cpdef inline void %s(self' % method_name
    header += ', int idx)' if idx_as_arg else ')'
    header += ' nogil:' if nogil else ':'
    return header


def decorate_method(wrapped):
    """The decorated method will return a |Lines| object including
    a method header.  However, the |Lines| object will be empty if
    the respective model does not implement a method with the same
    name as the wrapped method.
    """
    def wrapper(self):
        lines = Lines()
        if hasattr(self.model, wrapped.__name__):
            print('            . %s' % wrapped.__name__)
            lines.add(1, method_header(wrapped.__name__, nogil=True))
            for line in wrapped(self):
                lines.add(2, line)
        return lines
    functools.update_wrapper(wrapper, wrapped)
    wrapper.__doc__ = 'Lines of model method %s.' % wrapped.__name__
    return property(wrapper)


class Cythonizer(object):
    """Handles the writing, compiling and initialization of cython models.
    """

    def __init__(self):
        frame = inspect.currentframe().f_back
        self.pymodule = frame.f_globals['__name__']
        for (key, value) in frame.f_locals.items():
            setattr(self, key, value)

    def complete(self):
        if (not pub._is_hydpy_bundled) and self.outdated:
            usecython = pub.options.usecython
            try:
                if not pub.options.skipdoctests:
                    pub.options.usecython = False
                    self.tester.doit()
                if usecython:
                    self.doit()
                    if not pub.options.skipdoctests:
                        pub.options.usecython = True
                        self.tester.doit()
            finally:
                pub.options.usecython = usecython

    def doit(self):
        with printtools.PrintStyle(color=33, font=4):
            print('Translate module/package %s.' % self.pyname)
        with printtools.PrintStyle(color=33, font=2):
            self.pyxwriter.write()
        with printtools.PrintStyle(color=31, font=4):
            print('Compile module %s.' % self.cyname)
        with printtools.PrintStyle(color=31, font=2):
            self.compile_()
            self.move_dll()

    @property
    def pyname(self):
        """Name of the compiled module."""
        if self.pymodule.endswith('__init__'):
            return self.pymodule.split('.')[-2]
        else:
            return self.pymodule.split('.')[-1]

    @property
    def cyname(self):
        """Name of the compiled module."""
        return 'c_' + self.pyname

    @property
    def cydirpath(self):
        """Absolute path of the directory containing the compiled modules."""
        return cythons.autogen.__path__[0]

    @property
    def cymodule(self):
        """The compiled module."""
        return importlib.import_module('hydpy.cythons.autogen.'+self.cyname)

    @property
    def cyfilepath(self):
        """Absolute path of the compiled module."""
        return os.path.join(self.cydirpath, self.cyname+'.pyx')

    @property
    def buildpath(self):
        """Absolute path for temporarily build files."""
        return os.path.join(self.cydirpath, '_build')

    @property
    def pyxwriter(self):
        """Update the pyx file."""
        model = self.Model()
        if hasattr(self, 'Parameters'):
            model.parameters = self.Parameters(vars(self))
        else:
            model.parameters = parametertools.Parameters(vars(self))
        if hasattr(self, 'Sequences'):
            model.sequences = self.Sequences(model=model, **vars(self))
        else:
            model.sequences = sequencetools.Sequences(model=model,
                                                      **vars(self))
        return PyxWriter(self, model, self.cyfilepath)

    @property
    def pysourcefiles(self):
        """All source files of the actual models Python classes and their
        respective base classes."""
        sourcefiles = set()
        for (name, child) in vars(self).items():
            try:
                parents = inspect.getmro(child)
            except AttributeError:
                continue
            for parent in parents:
                try:
                    sourcefile = inspect.getfile(parent)
                except TypeError:
                    break
                sourcefiles.add(sourcefile)
        return Lines(*sourcefiles)

    @property
    def outdated(self):
        """True if at least one of the |Cythonizer.pysourcefiles| is
        newer than the compiled file under |Cythonizer.cyfilepath|,
        otherwise False.
        """
        if not os.path.exists(self.cyfilepath):
            return True
        cydate = os.stat(self.cyfilepath).st_mtime
        for pysourcefile in self.pysourcefiles:
            pydate = os.stat(pysourcefile).st_mtime
            if pydate > cydate:
                return True
        return False

    def compile_(self):
        """Translate cython code to C code and compile it."""
        from Cython import Build
        argv = copy.deepcopy(sys.argv)
        sys.argv = [sys.argv[0], 'build_ext', '--build-lib='+self.buildpath]
        exc_modules = [
                distutils.extension.Extension(
                        'hydpy.cythons.autogen.'+self.cyname,
                        [self.cyfilepath], extra_compile_args=['-O2'])]
        distutils.core.setup(ext_modules=Build.cythonize(exc_modules),
                             include_dirs=[numpy.get_include()])
        sys.argv = argv

    def move_dll(self):
        """Try to find the resulting dll file and to move it into the
        `cythons` package.

        Things to be aware of:
          * The file extension either `pyd` (Window) or `so` (Linux).
          * The folder containing the dll file is system dependent, but is
            always a subfolder of the `cythons` package.
          * Under Linux, the filename might contain system information, e.g.
            ...cpython-36m-x86_64-linux-gnu.so.
        """
        dirinfos = os.walk(self.buildpath)
        next(dirinfos)
        system_dependent_filename = None
        for dirinfo in dirinfos:
            for filename in dirinfo[2]:
                if (filename.startswith(self.cyname) and
                        filename.endswith(dllextension)):
                    system_dependent_filename = filename
                    break
            if system_dependent_filename:
                try:
                    shutil.move(os.path.join(dirinfo[0],
                                             system_dependent_filename),
                                os.path.join(self.cydirpath,
                                             self.cyname+dllextension))
                    break
                except BaseException:
                    prefix = ('After trying to cythonize module %s, when '
                              'trying to move the final cython module %s '
                              'from directory %s to directory %s'
                              % (self.pyname, system_dependent_filename,
                                 self.buildpath, self.cydirpath))
                    suffix = ('A likely error cause is that the cython module '
                              '%s does already exist in this directory and is '
                              'currently blocked by another Python process.  '
                              'Maybe it helps to close all Python processes '
                              'and restart the cyhonization afterwards.'
                              % self.cyname+dllextension)
                    objecttools.augment_excmessage(prefix, suffix)
        else:
            raise IOError('After trying to cythonize module %s, the resulting '
                          'file %s could neither be found in directory %s nor '
                          'its subdirectories.  The distul report should tell '
                          'whether the file has been stored somewhere else,'
                          'is named somehow else, or could not be build at '
                          'all.' % self.buildpath)

    def __dir__(self):
        return objecttools.dir_(self)


class PyxWriter(object):
    """Writes a new pyx file into framework.models.cython when initialized.
    """

    def __init__(self, cythonizer, model, pyxpath):
        self.cythonizer = cythonizer
        self.model = model
        self.pyxpath = pyxpath

    def write(self):
        with open(self.pyxpath, 'w') as pxf:
            print('    %s' % '* cython options')
            pxf.write(repr(self.cythonoptions))
            print('    %s' % '* C imports')
            pxf.write(repr(self.cimports))
            print('    %s' % '* constants (if defined)')
            pxf.write(repr(self.constants))
            print('    %s' % '* parameter classes')
            pxf.write(repr(self.parameters))
            print('    %s' % '* sequence classes')
            pxf.write(repr(self.sequences))
            print('    %s' % '* numerical parameters')
            pxf.write(repr(self.numericalparameters))
            print('    %s' % '* model class')
            print('        %s' % '- model attributes')
            pxf.write(repr(self.modeldeclarations))
            print('        %s' % '- standard functions')
            pxf.write(repr(self.modelstandardfunctions))
            print('        %s' % '- numeric functions')
            pxf.write(repr(self.modelnumericfunctions))
            print('        %s' % '- additional functions')
            pxf.write(repr(self.modeluserfunctions))

    @property
    def cythonoptions(self):
        """Cython option lines."""
        flag = 'False' if pub.options.fastcython else 'True'
        return Lines('#!python',
                     '#cython: boundscheck=%s' % flag,
                     '#cython: wraparound=%s' % flag,
                     '#cython: initializedcheck=%s' % flag)

    @property
    def cimports(self):
        """Import command lines."""
        return Lines('import numpy',
                     'cimport numpy',
                     'from libc.math cimport exp, fabs, log',
                     'from libc.stdio cimport *',
                     'from libc.stdlib cimport *',
                     'import cython',
                     'from cpython.mem cimport PyMem_Malloc',
                     'from cpython.mem cimport PyMem_Realloc',
                     'from cpython.mem cimport PyMem_Free',
                     'from hydpy.cythons.autogen cimport pointerutils',
                     'from hydpy.cythons.autogen cimport configutils',
                     'from hydpy.cythons.autogen cimport smoothutils',
                     'from hydpy.cythons.autogen cimport annutils')

    @property
    def constants(self):
        """Constants declaration lines."""
        lines = Lines()
        for (name, member) in vars(self.cythonizer).items():
            if (name.isupper() and
                    (not inspect.isclass(member)) and
                    (type(member) in TYPE2STR)):
                ndim = numpy.array(member).ndim
                ctype = TYPE2STR[type(member)] + NDIM2STR[ndim]
                lines.add(0, 'cdef public %s %s = %s'
                             % (ctype, name, member))
        return lines

    @property
    def parameters(self):
        """Parameter declaration lines."""
        lines = Lines()
        lines.add(0, '@cython.final')
        lines.add(0, 'cdef class Parameters(object):')
        for subpars in self.model.parameters:
            lines.add(1, 'cdef public %s %s'
                         % (objecttools.classname(subpars), subpars.name))
        for subpars in self.model.parameters:
            print('        - %s' % subpars.name)
            lines.add(0, '@cython.final')
            lines.add(0, 'cdef class %s(object):'
                         % objecttools.classname(subpars))
            for par in subpars:
                try:
                    ctype = TYPE2STR[par.TYPE] + NDIM2STR[par.NDIM]
                except KeyError:
                    ctype = par.TYPE + NDIM2STR[par.NDIM]
                lines.add(1, 'cdef public %s %s' % (ctype, par.name))
        return lines

    @property
    def sequences(self):
        """Sequence declaration lines."""
        lines = Lines()
        lines.add(0, '@cython.final')
        lines.add(0, 'cdef class Sequences(object):')
        for subseqs in self.model.sequences:
            lines.add(1, 'cdef public %s %s'
                         % (objecttools.classname(subseqs), subseqs.name))
        if getattr(self.model.sequences, 'states', None) is not None:
            lines.add(1, 'cdef public StateSequences old_states')
            lines.add(1, 'cdef public StateSequences new_states')
        for subseqs in self.model.sequences:
            print('        - %s' % subseqs.name)
            lines.add(0, '@cython.final')
            lines.add(0, 'cdef class %s(object):'
                         % objecttools.classname(subseqs))
            for seq in subseqs:
                ctype = 'double' + NDIM2STR[seq.NDIM]
                if isinstance(subseqs, sequencetools.LinkSequences):
                    if seq.NDIM == 0:
                        lines.add(1, 'cdef double *%s' % seq.name)
                    elif seq.NDIM == 1:
                        lines.add(1, 'cdef double **%s' % seq.name)
                        lines.add(1, 'cdef public int len_%s' % seq.name)
                else:
                    lines.add(1, 'cdef public %s %s' % (ctype, seq.name))
                lines.add(1, 'cdef public int _%s_ndim' % seq.name)
                lines.add(1, 'cdef public int _%s_length' % seq.name)
                for idx in range(seq.NDIM):
                    lines.add(1, 'cdef public int _%s_length_%d'
                                 % (seq.name, idx))
                if seq.NUMERIC:
                    ctype_numeric = 'double' + NDIM2STR[seq.NDIM+1]
                    lines.add(1, 'cdef public %s _%s_points'
                                 % (ctype_numeric, seq.name))
                    lines.add(1, 'cdef public %s _%s_results'
                                 % (ctype_numeric, seq.name))
                    if isinstance(subseqs, sequencetools.FluxSequences):
                        lines.add(1, 'cdef public %s _%s_integrals'
                                     % (ctype_numeric, seq.name))
                        lines.add(1, 'cdef public %s _%s_sum'
                                     % (ctype, seq.name))
                if isinstance(subseqs, sequencetools.IOSequences):
                    lines.extend(self.iosequence(seq))
            if isinstance(subseqs, sequencetools.InputSequences):
                lines.extend(self.load_data(subseqs))
            if isinstance(subseqs, sequencetools.IOSequences):
                lines.extend(self.open_files(subseqs))
                lines.extend(self.close_files(subseqs))
                if not isinstance(subseqs, sequencetools.InputSequence):
                    lines.extend(self.save_data(subseqs))
            if isinstance(subseqs, sequencetools.LinkSequences):
                lines.extend(self.set_pointer(subseqs))
        return lines

    def iosequence(self, seq):
        """Special declaration lines for the given |IOSequence| object.
        """
        lines = Lines()
        lines.add(1, 'cdef public bint _%s_diskflag' % seq.name)
        lines.add(1, 'cdef public str _%s_path' % seq.name)
        lines.add(1, 'cdef FILE *_%s_file' % seq.name)
        lines.add(1, 'cdef public bint _%s_ramflag' % seq.name)
        ctype = 'double' + NDIM2STR[seq.NDIM+1]
        lines.add(1, 'cdef public %s _%s_array' % (ctype, seq.name))
        return lines

    def open_files(self, subseqs):
        """Open file statements."""
        print('            . open_files')
        lines = Lines()
        lines.add(1, 'cpdef open_files(self, int idx):')
        for seq in subseqs:
            lines.add(2, 'if self._%s_diskflag:' % seq.name)
            lines.add(3, 'self._%s_file = fopen(str(self._%s_path).encode(), '
                         '"rb+")' % (2*(seq.name,)))
            if seq.NDIM == 0:
                lines.add(3,
                          'fseek(self._%s_file, idx*8, SEEK_SET)' % seq.name)
            else:
                lines.add(3, 'fseek(self._%s_file, idx*self._%s_length*8, '
                             'SEEK_SET)' % (2*(seq.name,)))
        return lines

    def close_files(self, subseqs):
        """Close file statements."""
        print('            . close_files')
        lines = Lines()
        lines.add(1, 'cpdef inline close_files(self):')
        for seq in subseqs:
            lines.add(2, 'if self._%s_diskflag:' % seq.name)
            lines.add(3, 'fclose(self._%s_file)' % seq.name)
        return lines

    def load_data(self, subseqs):
        """Load data statements."""
        print('            . load_data')
        lines = Lines()
        lines.add(1, 'cpdef inline void load_data(self, int idx) %s:' % _nogil)
        lines.add(2, 'cdef int jdx0, jdx1, jdx2, jdx3, jdx4, jdx5')
        for seq in subseqs:
            lines.add(2, 'if self._%s_diskflag:' % seq.name)
            if seq.NDIM == 0:
                lines.add(3, 'fread(&self.%s, 8, 1, self._%s_file)'
                             % (2*(seq.name,)))
            else:
                lines.add(3, 'fread(&self.%s[0], 8, self._%s_length, '
                             'self._%s_file)' % (3*((seq.name,))))
            lines.add(2, 'elif self._%s_ramflag:' % seq.name)
            if seq.NDIM == 0:
                lines.add(3, 'self.%s = self._%s_array[idx]' % (2*(seq.name,)))
            else:
                indexing = ''
                for idx in range(seq.NDIM):
                    lines.add(3+idx, 'for jdx%d in range(self._%s_length_%d):'
                                     % (idx, seq.name, idx))
                    indexing += 'jdx%d,' % idx
                indexing = indexing[:-1]
                lines.add(3+seq.NDIM, 'self.%s[%s] = self._%s_array[idx,%s]'
                                      % (2*(seq.name, indexing)))
        return lines

    def save_data(self, subseqs):
        """Save data statements."""
        print('            . save_data')
        lines = Lines()
        lines.add(1, 'cpdef inline void save_data(self, int idx) %s:' % _nogil)
        lines.add(2, 'cdef int jdx0, jdx1, jdx2, jdx3, jdx4, jdx5')
        for seq in subseqs:
            lines.add(2, 'if self._%s_diskflag:' % seq.name)
            if seq.NDIM == 0:
                lines.add(3, 'fwrite(&self.%s, 8, 1, self._%s_file)'
                             % (2*(seq.name,)))
            else:
                lines.add(3, 'fwrite(&self.%s[0], 8, self._%s_length, '
                             'self._%s_file)' % (3*(seq.name,)))
            lines.add(2, 'elif self._%s_ramflag:' % seq.name)
            if seq.NDIM == 0:
                lines.add(3, 'self._%s_array[idx] = self.%s' % (2*(seq.name,)))
            else:
                indexing = ''
                for idx in range(seq.NDIM):
                    lines.add(3+idx, 'for jdx%d in range(self._%s_length_%d):'
                                     % (idx, seq.name, idx))
                    indexing += 'jdx%d,' % idx
                indexing = indexing[:-1]
                lines.add(3+seq.NDIM, 'self._%s_array[idx,%s] = self.%s[%s]'
                                      % (2*(seq.name, indexing)))
        return lines

    def set_pointer(self, subseqs):
        """Set_pointer functions for link sequences."""
        lines = Lines()
        for seq in subseqs:
            if seq.NDIM == 0:
                lines.extend(self.set_pointer0d(subseqs))
            break
        for seq in subseqs:
            if seq.NDIM == 1:
                lines.extend(self.alloc(subseqs))
                lines.extend(self.dealloc(subseqs))
                lines.extend(self.set_pointer1d(subseqs))
            break
        return lines

    def set_pointer0d(self, subseqs):
        """Set_pointer function for 0-dimensional link sequences."""
        print('            . set_pointer0d')
        lines = Lines()
        lines.add(1, 'cpdef inline set_pointer0d'
                     '(self, str name, pointerutils.PDouble value):')
        for seq in subseqs:
            lines.add(2, 'if name == "%s":' % seq.name)
            lines.add(3, 'self.%s = value.p_value' % seq.name)
        return lines

    def alloc(self, subseqs):
        """Allocate memory for 1-dimensional link sequences."""
        print('            . setlength')
        lines = Lines()
        lines.add(1, 'cpdef inline alloc(self, name, int length):')
        for seq in subseqs:
            lines.add(2, 'if name == "%s":' % seq.name)
            lines.add(3, 'self._%s_length_0 = length' % seq.name)
            lines.add(3, 'self.%s = <double**> '
                         'PyMem_Malloc(length * sizeof(double*))' % seq.name)
        return lines

    def dealloc(self, subseqs):
        """Deallocate memory for 1-dimensional link sequences."""
        print('            . dealloc')
        lines = Lines()
        lines.add(1, 'cpdef inline dealloc(self):')
        for seq in subseqs:
            lines.add(2, 'PyMem_Free(self.%s)' % seq.name)
        return lines

    def set_pointer1d(self, subseqs):
        """Set_pointer function for 1-dimensional link sequences."""
        print('            . set_pointer1d')
        lines = Lines()
        lines.add(1, 'cpdef inline set_pointer1d'
                     '(self, str name, pointerutils.PDouble value, int idx):')
        for seq in subseqs:
            lines.add(2, 'if name == "%s":' % seq.name)
            lines.add(3, 'self.%s[idx] = value.p_value' % seq.name)
        return lines

    @property
    def numericalparameters(self):
        """Numeric parameter declaration lines."""
        lines = Lines()
        if self.model.NUMERICAL:
            lines.add(0, '@cython.final')
            lines.add(0, 'cdef class NumConsts(object):')
            for name in ('nmb_methods', 'nmb_stages'):
                lines.add(1, 'cdef public %s %s' % (TYPE2STR[int], name))
            for name in ('dt_increase', 'dt_decrease'):
                lines.add(1, 'cdef public %s %s' % (TYPE2STR[float], name))
            lines.add(1, 'cdef public configutils.Config pub')
            lines.add(1, 'cdef public double[:, :, :] a_coefs')
            lines.add(0, 'cdef class NumVars(object):')
            for name in ('nmb_calls', 'idx_method', 'idx_stage'):
                lines.add(1, 'cdef public %s %s' % (TYPE2STR[int], name))
            for name in ('t0', 't1', 'dt', 'dt_est',
                         'error', 'last_error', 'extrapolated_error'):
                lines.add(1, 'cdef public %s %s' % (TYPE2STR[float], name))
            lines.add(1, 'cdef public %s f0_ready' % TYPE2STR[bool])
        return lines

    @property
    def modeldeclarations(self):
        """Attribute declarations of the model class."""
        lines = Lines()
        lines.add(0, '@cython.final')
        lines.add(0, 'cdef class Model(object):')
        lines.add(1, 'cdef public int idx_sim')
        lines.add(1, 'cdef public Parameters parameters')
        lines.add(1, 'cdef public Sequences sequences')
        if hasattr(self.model, 'numconsts'):
            lines.add(1, 'cdef public NumConsts numconsts')
        if hasattr(self.model, 'numvars'):
            lines.add(1, 'cdef public NumVars numvars')
        return lines

    @property
    def modelstandardfunctions(self):
        """Standard functions of the model class."""
        lines = Lines()
        lines.extend(self.doit)
        lines.extend(self.iofunctions)
        lines.extend(self.new2old)
        lines.extend(self.run)
        lines.extend(self.update_inlets)
        lines.extend(self.update_outlets)
        lines.extend(self.update_receivers)
        lines.extend(self.update_senders)
        return lines

    @property
    def modelnumericfunctions(self):
        """Numerical functions of the model class."""
        lines = Lines()
        lines.extend(self.solve)
        lines.extend(self.calculate_single_terms)
        lines.extend(self.calculate_full_terms)
        lines.extend(self.get_point_states)
        lines.extend(self.set_point_states)
        lines.extend(self.set_result_states)
        lines.extend(self.get_sum_fluxes)
        lines.extend(self.set_point_fluxes)
        lines.extend(self.set_result_fluxes)
        lines.extend(self.integrate_fluxes)
        lines.extend(self.reset_sum_fluxes)
        lines.extend(self.addup_fluxes)
        lines.extend(self.calculate_error)
        lines.extend(self.extrapolate_error)
        return lines

    @property
    def doit(self):
        """Do (most of) it function of the model class."""
        print('                . doit')
        lines = Lines()
        lines.add(1, 'cpdef inline void doit(self, int idx) %s:' % _nogil)
        lines.add(2, 'self.idx_sim = idx')
        if getattr(self.model.sequences, 'inputs', None) is not None:
            lines.add(2, 'self.load_data()')
        if self.model._INLET_METHODS:
            lines.add(2, 'self.update_inlets()')
        if hasattr(self.model, 'solve'):
            lines.add(2, 'self.solve()')
        else:
            lines.add(2, 'self.run()')
            if getattr(self.model.sequences, 'states', None) is not None:
                lines.add(2, 'self.new2old()')
        if self.model._OUTLET_METHODS:
            lines.add(2, 'self.update_outlets()')
        return lines

    @property
    def iofunctions(self):
        """Input/output functions of the model class."""
        lines = Lines()
        for func in ('open_files', 'close_files', 'load_data', 'save_data'):
            if ((func == 'load_data') and
                    (getattr(self.model.sequences, 'inputs', None) is None)):
                continue
            if ((func == 'save_data') and
                ((getattr(self.model.sequences, 'fluxes', None) is None) and
                 (getattr(self.model.sequences, 'states', None) is None))):
                continue
            print('            . %s' % func)
            nogil = func in ('load_data', 'save_data')
            idx_as_arg = func == 'save_data'
            lines.add(1, method_header(
                func, nogil=nogil, idx_as_arg=idx_as_arg))
            for subseqs in self.model.sequences:
                if func == 'load_data':
                    applyfuncs = ('inputs',)
                elif func == 'save_data':
                    applyfuncs = ('fluxes', 'states')
                else:
                    applyfuncs = ('inputs', 'fluxes', 'states')
                if subseqs.name in applyfuncs:
                    if func == 'close_files':
                        lines.add(2, 'self.sequences.%s.%s()'
                                     % (subseqs.name, func))
                    else:
                        lines.add(2, 'self.sequences.%s.%s(self.idx_sim)'
                                     % (subseqs.name, func))
        return lines

    @property
    def new2old(self):
        lines = Lines()
        if getattr(self.model.sequences, 'states', None) is not None:
            print('                . new2old')
            lines.add(1, method_header('new2old', nogil=True))
            lines.add(2, 'cdef int jdx0, jdx1, jdx2, jdx3, jdx4, jdx5')
            for seq in self.model.sequences.states:
                if seq.NDIM == 0:
                    lines.add(2, 'self.sequences.old_states.%s = '
                                 'self.sequences.new_states.%s'
                                 % (2*(seq.name,)))
                else:
                    indexing = ''
                    for idx in range(seq.NDIM):
                        lines.add(2+idx,
                                  'for jdx%d in range('
                                  'self.sequences.states._%s_length_%d):'
                                  % (idx, seq.name, idx))
                        indexing += 'jdx%d,' % idx
                    indexing = indexing[:-1]
                    lines.add(
                        2+seq.NDIM,
                        'self.sequences.old_states.%s[%s] = '
                        'self.sequences.new_states.%s[%s]'
                        % (2*(seq.name, indexing)))
        return lines

    def _call_methods(self, name, methods, idx_as_arg=False):
        lines = Lines()
        if hasattr(self.model, name):
            lines.add(1, method_header(name,
                                       nogil=True,
                                       idx_as_arg=idx_as_arg))
            if idx_as_arg:
                lines.add(2, 'self.idx_sim = idx')
            anything = False
            for method in methods:
                lines.add(2, 'self.%s()' % method.__name__)
                anything = True
            if not anything:
                lines.add(2, 'pass')
        return lines

    @property
    def update_receivers(self):
        """Lines of model method with the same name."""
        return self._call_methods('update_receivers',
                                  self.model._RECEIVER_METHODS,
                                  True)

    @property
    def update_inlets(self):
        """Lines of model method with the same name."""
        return self._call_methods('update_inlets',
                                  self.model._INLET_METHODS)

    @property
    def run(self):
        """Lines of model method with the same name."""
        return self._call_methods('run',
                                  self.model._RUN_METHODS)

    @property
    def update_outlets(self):
        """Lines of model method with the same name."""
        return self._call_methods('update_outlets',
                                  self.model._OUTLET_METHODS)

    @property
    def update_senders(self):
        """Lines of model method with the same name."""
        return self._call_methods('update_senders',
                                  self.model._SENDER_METHODS,
                                  True)

    @property
    def calculate_single_terms(self):
        """Lines of model method with the same name."""
        lines = self._call_methods('calculate_single_terms',
                                   self.model._PART_ODE_METHODS)
        if lines:
            lines.insert(1, ('        self.numvars.nmb_calls ='
                             'self.numvars.nmb_calls+1'))
        return lines

    @property
    def calculate_full_terms(self):
        """Lines of model method with the same name."""
        return self._call_methods('calculate_full_terms',
                                  self.model._FULL_ODE_METHODS)

    @property
    def listofmodeluserfunctions(self):
        """User functions of the model class."""
        lines = []
        for (name, member) in vars(self.model.__class__).items():
            if (inspect.isfunction(member) and
                    (name not in ('run', 'new2old')) and
                    ('fastaccess' in inspect.getsource(member))):
                lines.append((name, member))
        run = vars(self.model.__class__).get('run')
        if run is not None:
            lines.append(('run', run))
        for (name, member) in vars(self.model).items():
            if (inspect.ismethod(member) and
                    ('fastaccess' in inspect.getsource(member))):
                lines.append((name, member))
        return lines

    @property
    def modeluserfunctions(self):
        lines = Lines()
        for (name, func) in self.listofmodeluserfunctions:
            print('            . %s' % name)
            funcconverter = FuncConverter(self.model, name, func)
            lines.extend(funcconverter.pyxlines)
        return lines

    @property
    def solve(self):
        lines = Lines()
        if hasattr(self.model, 'solve'):
            print('            . solve')
            funcconverter = FuncConverter(self.model, 'solve',
                                          self.model.solve)
            lines.extend(funcconverter.pyxlines)
        return lines

    @staticmethod
    def _assign_seqvalues(subseqs, subseqs_name, target, index, load):
        from1 = 'self.sequences.%s.' % subseqs_name + '%s'
        to1 = 'self.sequences.%s.' % subseqs_name + '_%s_' + target
        if index is not None:
            to1 += '[self.numvars.%s]' % index
        if load:
            from1, to1 = to1, from1
        for seq in subseqs:
            from2 = from1 % seq.name
            to2 = to1 % seq.name
            if seq.NDIM == 0:
                yield '%s = %s' % (to2, from2)
            elif seq.NDIM == 1:
                yield 'cdef int idx0'
                yield ('for idx0 in range(self.sequences.%s._%s_length0):'
                       % (subseqs.name, seq.name))
                yield ('    %s[idx0] = %s[idx0]'
                       % (to2, from2))
            elif seq.NDIM == 2:
                yield 'cdef int idx0, idx1'
                yield ('for idx0 in range(self.sequences.%s._%s_length0):'
                       % (subseqs.name, seq.name))
                yield ('    for idx1 in range(self.sequences._%s_length1):'
                       % (subseqs.name, seq.name))
                yield ('        %s[idx0, idx1] = %s[idx0, idx1]'
                       % (to2, from2))
            else:
                raise NotImplementedError(
                    'NDIM of sequence `%s` is higher than expected' % seq.name)

    @decorate_method
    def get_point_states(self):
        yield self._assign_seqvalues(
            subseqs=self.model.sequences.states,
            subseqs_name='states',
            target='points',
            index='idx_stage',
            load=True)

    @decorate_method
    def set_point_states(self):
        yield self._assign_seqvalues(
            subseqs=self.model.sequences.states,
            subseqs_name='states',
            target='points',
            index='idx_stage',
            load=False)

    @decorate_method
    def set_result_states(self):
        yield self._assign_seqvalues(
            subseqs=self.model.sequences.states,
            subseqs_name='states',
            target='results',
            index='idx_method',
            load=False)

    @decorate_method
    def get_sum_fluxes(self):
        yield self._assign_seqvalues(
            subseqs=self.model.sequences.fluxes.numerics,
            subseqs_name='fluxes',
            target='sum',
            index=None,
            load=True)

    @decorate_method
    def set_point_fluxes(self):
        yield self._assign_seqvalues(
            subseqs=self.model.sequences.fluxes.numerics,
            subseqs_name='fluxes',
            target='points',
            index='idx_stage',
            load=False)

    @decorate_method
    def set_result_fluxes(self):
        yield self._assign_seqvalues(
            subseqs=self.model.sequences.fluxes.numerics,
            subseqs_name='fluxes',
            target='results',
            index='idx_method',
            load=False)

    @decorate_method
    def integrate_fluxes(self):
        max_ndim = -1
        for seq in self.model.sequences.fluxes.numerics:
            max_ndim = max(max_ndim, seq.NDIM)
        if max_ndim == 0:
            yield 'cdef int jdx'
        elif max_ndim == 1:
            yield 'cdef int jdx, idx0'
        elif max_ndim == 2:
            yield 'cdef int jdx, idx0, idx1'
        for seq in self.model.sequences.fluxes.numerics:
            to_ = 'self.sequences.fluxes.%s' % seq.name
            from_ = 'self.sequences.fluxes._%s_points' % seq.name
            coefs = ('self.numvars.dt * self.numconsts.a_coefs'
                     '[self.numvars.idx_method-1,self.numvars.idx_stage,jdx]')
            if seq.NDIM == 0:
                yield '%s = 0.' % to_
                yield 'for jdx in range(self.numvars.idx_method):'
                yield '    %s = %s +%s*%s[jdx]' % (to_, to_, coefs, from_)
            elif seq.NDIM == 1:
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield '    %s[idx0] = 0.' % to_
                yield '    for jdx in range(self.numvars.idx_method):'
                yield ('        %s[idx0] = %s[idx0] + %s*%s[jdx, idx0]'
                       % (to_, to_, coefs, from_))
            elif seq.NDIM == 2:
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield ('    for idx1 in range('
                       'self.sequences.fluxes._%s_length1):' % seq.name)
                yield '        %s[idx0, idx1] = 0.' % to_
                yield '        for jdx in range(self.numvars.idx_method):'
                yield ('            %s[idx0, idx1] = '
                       '%s[idx0, idx1] + %s*%s[jdx, idx0, idx1]'
                       % (to_, to_, coefs, from_))
            else:
                raise NotImplementedError(
                    'NDIM of sequence `%s` is higher than expected' % seq.name)

    @decorate_method
    def reset_sum_fluxes(self):
        for seq in self.model.sequences.fluxes.numerics:
            to_ = 'self.sequences.fluxes._%s_sum' % seq.name
            if seq.NDIM == 0:
                yield '%s = 0.' % to_
            elif seq.NDIM == 1:
                yield 'cdef int idx0'
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield '    %s[idx0] = 0.' % to_
            elif seq.NDIM == 2:
                yield 'cdef int idx0, idx1'
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield ('    for idx1 in range('
                       'self.sequences.fluxes._%s_length1):' % seq.name)
                yield '        %s[idx0, idx1] = 0.' % to_
            else:
                raise NotImplementedError(
                    'NDIM of sequence `%s` is higher than expected' % seq.name)

    @decorate_method
    def addup_fluxes(self):
        for seq in self.model.sequences.fluxes.numerics:
            to_ = 'self.sequences.fluxes._%s_sum' % seq.name
            from_ = 'self.sequences.fluxes.%s' % seq.name
            if seq.NDIM == 0:
                yield '%s = %s + %s' % (to_, to_, from_)
            elif seq.NDIM == 1:
                yield 'cdef int idx0'
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield ('    %s[idx0] = %s[idx0] + %s[idx0]'
                       % (to_, to_, from_))
            elif seq.NDIM == 2:
                yield 'cdef int idx0, idx1'
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield ('    for idx1 in range('
                       'self.sequences.fluxes._%s_length1):' % seq.name)
                yield ('        %s[idx0, idx1] = '
                       '%s[idx0, idx1] + %s[idx0, idx1]'
                       % (to_, to_, from_))
            else:
                raise NotImplementedError(
                    'NDIM of sequence `%s` is higher than expected' % seq.name)

    @decorate_method
    def calculate_error(self):
        to_ = 'self.numvars.error'
        index = 'self.numvars.idx_method'
        yield '%s = 0.' % to_
        for seq in self.model.sequences.fluxes.numerics:
            from_ = 'self.sequences.fluxes._%s_results' % seq.name
            if seq.NDIM == 0:
                yield ('%s = max(%s, fabs(%s[%s]-%s[%s-1]))'
                       % (to_, to_, from_, index, from_, index))
            elif seq.NDIM == 1:
                yield 'cdef int idx0'
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield ('    %s = max(%s, abs(%s[%s, idx0]-%s[%s-1, idx0]))'
                       % (to_, to_, from_, index, from_, index))
            elif seq.NDIM == 2:
                yield 'cdef int idx0, idx1'
                yield ('for idx0 in range(self.sequences.fluxes._%s_length0):'
                       % seq.name)
                yield ('    for idx1 in range('
                       'self.sequences.fluxes._%s_length1):' % seq.name)
                yield ('        %s = '
                       'max(%s, abs(%s[%s, idx0, idx1]-%s[%s-1, idx0, idx1]))'
                       % (to_, to_, from_, index, from_, index))
            else:
                raise NotImplementedError(
                    'NDIM of sequence `%s` is higher than expected' % seq.name)

    @property
    def extrapolate_error(self):
        lines = Lines()
        if hasattr(self.model, 'extrapolate_error'):
            print('            . extrapolate_error')
            funcconverter = FuncConverter(self.model, 'extrapolate_error',
                                          self.model.extrapolate_error)
            lines.extend(funcconverter.pyxlines)
        return lines


class FuncConverter(object):

    def __init__(self, model, funcname, func):
        self.model = model
        self.funcname = funcname
        self.func = func

    @property
    def argnames(self):
        return inspect.getargs(self.func.__code__)[0]

    @property
    def varnames(self):
        return self.func.__code__.co_varnames

    @property
    def locnames(self):
        return [vn for vn in self.varnames if vn not in self.argnames]

    @property
    def sourcelines(self):
        return Lines(*inspect.getsourcelines(self.func)[0])

    @property
    def collectornames(self):
        names = []
        for groupname in ('parameters', 'sequences'):
            for subgroup in getattr(self.model, groupname):
                if subgroup.name[:3] in self.varnames:
                    names.append(groupname + '.' + subgroup.name)
        if 'old' in self.varnames:
            names.append('sequences.old_states')
        if 'new' in self.varnames:
            names.append('sequences.new_states')
        return names

    @property
    def collectorshortcuts(self):
        return [name.split('.')[-1][:3] for name in self.collectornames]

    @property
    def untypedvarnames(self):
        return [name for name in self.varnames
                if name not in (self.collectorshortcuts + ['self'])]

    @property
    def untypedarguments(self):
        defline = self.cleanlines[0]
        return [name for name in self.untypedvarnames
                if ((', %s,' % name in defline) or
                    (', %s)' % name in defline))]

    @property
    def untypedinternalvarnames(self):
        return [name for name in self.untypedvarnames if
                name not in self.untypedarguments]

    @property
    def cleanlines(self):
        """Cleaned code lines.

        Implemented cleanups:
          * eventually remove method version
          * remove docstrings
          * remove comments
          * remove empty lines
          * remove line brackes within brackets
          * replace `modelutils` with nothing
          * remove complete lines containing `fastaccess`
          * replace shortcuts with complete references
        """
        code = inspect.getsource(self.func)
        code = '\n'.join(code.split('"""')[::2])
        code = code.replace('modelutils.', '')
        for (name, shortcut) in zip(self.collectornames,
                                    self.collectorshortcuts):
            code = code.replace('%s.' % shortcut, 'self.%s.' % name)
        code = self.remove_linebreaks_within_equations(code)
        lines = code.splitlines()
        self.remove_imath_operators(lines)
        lines[0] = 'def %s(self):' % self.funcname
        lines = [l.split('#')[0] for l in lines]
        lines = [l for l in lines if 'fastaccess' not in l]
        lines = [l.rstrip() for l in lines if l.rstrip()]
        return Lines(*lines)

    @staticmethod
    def remove_linebreaks_within_equations(code):
        r"""Remove line breaks within equations.

        This is not a exhaustive test, but shows how the method works:

        >>> code = 'asdf = \\\n(a\n+b)'
        >>> from hydpy.cythons.modelutils import FuncConverter
        >>> FuncConverter.remove_linebreaks_within_equations(code)
        'asdf = (a+b)'
        """
        code = code.replace('\\\n', '')
        chars = []
        counter = 0
        for char in code:
            if char in ('(', '[', '{'):
                counter += 1
            elif char in (')', ']', '}'):
                counter -= 1
            if not (counter and (char == '\n')):
                chars.append(char)
        return ''.join(chars)

    @staticmethod
    def remove_imath_operators(lines):
        """Remove mathematical expressions that require Pythons global
        interpreter locking mechanism.

        This is not a exhaustive test, but shows how the method works:

        >>> lines = ['    x += 1*1']
        >>> from hydpy.cythons.modelutils import FuncConverter
        >>> FuncConverter.remove_imath_operators(lines)
        >>> lines
        ['    x = x + (1*1)']
        """
        for idx, line in enumerate(lines):
            for operator in ('+=', '-=', '**=', '*=', '//=', '/=', '%='):
                sublines = line.split(operator)
                if len(sublines) > 1:
                    indent = line.count(' ') - line.lstrip().count(' ')
                    sublines = [sl.strip() for sl in sublines]
                    line = ('%s%s = %s %s (%s)'
                            % (indent*' ', sublines[0], sublines[0],
                               operator[:-1], sublines[1]))
                    lines[idx] = line

    @property
    def pyxlines(self):
        """Cython code lines.

        Assumptions:
          * Function shall be a method
          * Method shall be inlined
          * Method returns nothing
          * Method arguments are of type `int` (except self)
          * Local variables are generally of type `int` but of type `double`
            when their name starts with `d_`
        """
        lines = ['    '+line for line in self.cleanlines]
        lines[0] = lines[0].replace('def ', 'cpdef inline void ')
        lines[0] = lines[0].replace('):', ') %s:' % _nogil)
        for name in self.untypedarguments:
            lines[0] = lines[0].replace(', %s ' % name, ', int %s ' % name)
            lines[0] = lines[0].replace(', %s)' % name, ', int %s)' % name)
        for name in self.untypedinternalvarnames:
            if name.startswith('d_'):
                lines.insert(1, '        cdef double ' + name)
            else:
                lines.insert(1, '        cdef int ' + name)
        return Lines(*lines)


def exp(double):
    """Cython wrapper for numpys exp function applied on a single float."""
    return numpy.exp(double)


def log(double):
    """Cython wrapper for numpys log function applied on a single float."""
    return numpy.log(double)


def fabs(double):
    """Cython wrapper for maths fabs function applied on a single float."""
    return math.fabs(double)


autodoctools.autodoc_module()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/cythons/autogen/__init__.py

1  
#

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/modify_html.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
# -*- coding: utf-8 -*-
"""Beautify the html documentation generated by `Sphinx`."""

from __future__ import division, print_function
import os
import sys

try:
    print('\nModify html files:')
    folder = os.path.join('doc', 'build')
    paths = [os.path.join(folder, fn) for fn in os.listdir(folder)
             if fn.endswith('.html')]
    for path in paths:
        path = os.path.abspath(path)
        print('  ' + path)
        sys.stdout.flush()
        lines = []
        with open(path) as file_:
            for line in file_:
                if line.startswith('<dd><p>alias of <a '
                                   'class="reference external"'):
                    line = line.split('span')[1]
                    line = line.split('>')[1]
                    line = line.split('<')[0]
                    lines[-1] = lines[-1].replace(
                           'TYPE</code>',
                           'TYPE</code><em class="property"> = %s</em>' % line)
                else:
                    lines.append(line)
        with open(path, 'w') as file_:
            file_.write(''.join(lines))
except BaseException as exc:
    print(exc)
    sys.exit(1)
else:
    sys.exit(0)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/prepare.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
# -*- coding: utf-8 -*-
"""Move, create and modify documentation files before applying `Sphinx`.

Sphinx is to be executed in a freshly created folder named `auto`.  If
this folder exists already, `prepare` removes it first and builds it from
scratch afterwards, in order to assure that no old documentation files
find their way into the html documentation.
"""

# import...
# ...from standard library
import importlib
import inspect
import os
import shutil
import sys
os.chdir(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))
# pylint: disable=wrong-import-position
# (changing the path is necessary when calling `prepare.py` from the
# command line)
# ...from HydPy
import hydpy
from hydpy import auxs
from hydpy import core
from hydpy import cythons
from hydpy import docs
from hydpy import models
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
from hydpy.docs import figs
from hydpy.docs import sphinx
from hydpy.docs import rst

# Prepare folder `auto`.
AUTOPATH = os.path.join(docs.__path__[0], 'auto')
if os.path.exists(AUTOPATH):
    shutil.rmtree(AUTOPATH)
os.makedirs(AUTOPATH)
shutil.copytree(os.path.join(docs.__path__[0], 'html'),
                os.path.join(AUTOPATH, 'html'))
try:
    shutil.move(os.path.join(AUTOPATH, 'html', 'coverage.html'),
                os.path.join(AUTOPATH, 'coverage.html'))
except BaseException:
    print('coverage.html could not be moved')

# Import all base and application models, to make sure all substituters
# are up-to-date. (I am not sure, if this is really necessary, but it
# does not hurt.)
for filename in os.listdir(models.__path__[0]):
    if not filename.startswith('_'):
        filename = filename.split('.')[0]
        importlib.import_module(
            '%s.%s'
            % (models.__name__, filename))

# Write one rst file for each module (including the ones defining application
# models) and each base model defining a base model.  Each rst file should
# contain commands to trigger the autodoc mechanism of Sphinx as well as
# the substitution replacement commands relevant for the respective module
# or package.
for subpackage in (auxs, core, cythons, models):
    filenames = os.listdir(subpackage.__path__[0])
    substituter = hydpy.substituter
    for filename in filenames:
        is_module = (
            (filename.endswith('py') or filename.endswith('pyx')) and
            (filename != '__init__.py'))
        is_package = (
            (subpackage is models) and
            ('.' not in filename) and
            (filename not in ('build', '__pycache__')))
        if is_module:
            path = os.path.join(subpackage.__path__[0], filename)
            sources = [open(path, encoding='utf-8').read()]
            module = importlib.import_module(
                '%s.%s' % (subpackage.__name__, filename.split('.')[0]))
            for member in getattr(module, '__dict__', {}).values():
                if (inspect.isclass(member) and
                        issubclass(member, (parametertools.SubParameters,
                                            sequencetools.SubSequences,
                                            modeltools.Model))):
                    sources.append(member.__doc__ if member.__doc__ else '')
            source = '\n'.join(sources)
        if is_package:
            sources = []
            path = os.path.join(subpackage.__path__[0], filename)
            for subfilename in os.listdir(path):
                if subfilename.endswith('.py'):
                    subpath = os.path.join(path, subfilename)
                    sources.append(open(subpath, encoding='utf-8').read())
            source = '\n'.join(sources)
        filename = filename.split('.')[0]
        if (is_module and (subpackage is models)) or is_package:
            module = importlib.import_module(
                '%s.%s' % (models.__name__, filename))
            substituter = module.substituter
        if is_module or is_package:
            lines = []
            lines.append('')
            lines.append('.. _%s:' % filename)
            lines.append('')
            lines.append(filename)
            lines.append('=' * len(filename))
            lines.append('')
            lines.append('.. automodule:: %s'
                         % '.'.join((subpackage.__name__, filename)))
            lines.append('    :members:')
            lines.append('    :show-inheritance:')
            lines.append('')
            path = os.path.join(AUTOPATH, filename+'.rst')
            with open(path, 'w', encoding="utf-8") as file_:
                file_.write(substituter.get_commands(source))
                file_.write('\n')
                file_.write('\n'.join(lines))

# Copy additional files into folder `auto` and, for the rst files, add the
# required substitution replacement commands.
for subpackage in (figs, sphinx, rst):
    for filename in os.listdir(subpackage.__path__[0]):
        path_in = os.path.join(subpackage.__path__[0], filename)
        path_out = os.path.join(AUTOPATH, filename)
        if filename not in ('__init__.py', '__pycache__'):
            if subpackage is rst:
                orig = open(path_in, encoding="utf-8").read()
                with open(path_out, 'w', encoding="utf-8") as file_:
                    file_.write(hydpy.substituter.get_commands(orig))
                    file_.write('\n')
                    file_.write(orig)
            else:
                shutil.copy(path_in, path_out)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/figs/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/html/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/rst/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/sphinx/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/sphinx/apidoc.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  

import os
import webbrowser

os.system(r'make clean')
os.system(r'make html')

folder = r'C:\HydPy\hydpy\docs\auto\_build\html'
paths = [os.path.join(folder, fn) for fn in os.listdir(folder)
         if fn.endswith('.html')]
for path in paths:
        lines = []
        with open(path) as file_:
            for line in file_:
                if line.startswith('<dd><p>alias of <a '
                                   'class="reference external"'):
                    line = line.split('span')[1]
                    line = line.split('>')[1]
                    line = line.split('<')[0]
                    lines[-1] = lines[-1].replace(
                           'TYPE</code>',
                           'TYPE</code><em class="property"> = %s</em>' % line)
                else:
                    lines.append(line)
        with open(path, 'w') as file_:
            file_.write(''.join(lines))

os.chdir(r'C:\Program Files (x86)\Mozilla Firefox')
webbrowser.register('firefox', None, webbrowser.GenericBrowser('firefox'), 1)
webbrowser.get('firefox').open_new_tab(os.path.join(folder, 'index.html'))

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/docs/sphinx/conf.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
# -*- coding: utf-8 -*-
#
# HydPy documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 09 14:33:31 2016.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..\\..\\..\\'))

# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
              'sphinx.ext.napoleon',
              'sphinx.ext.intersphinx',
              'sphinx.ext.viewcode',
              'sphinx.ext.inheritance_diagram',
              'sphinx.ext.mathjax',
              'sphinx.ext.doctest',
              'sphinxcontrib.fulltoc',
              'sphinxprettysearchresults']

autoclass_content = 'class'
autodoc_default_flags = ['undoc-members']
autodoc_member_order = 'bysource'

# Napoleon settings
napoleon_google_docstring = False
napoleon_numpy_docstring = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = False
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = False
napoleon_use_rtype = False

intersphinx_mapping = {
    'python': ('https://docs.python.org/3', None),
    'numpy': ('http://docs.scipy.org/doc/numpy/', None),
    'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
    'matplotlib': ('http://matplotlib.sourceforge.net/', None)
    }

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'HydPy'
copyright = u'2018, Christoph Tyralla'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.1-dev'
# The full version, including alpha/beta/rc tags.
release = '2.1-dev'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []


# -- Options for HTML output ---------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = 'default'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
html_theme_options = {'stickysidebar': True,
                      'sidebarwidth': 300}

# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
#html_title = None

# A shorter title for the navigation bar.  Default is the same as html_title.
#html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = []
html_extra_path = ['html']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True

# If false, no index is generated.
#html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'HydPydoc'


# -- Options for LaTeX output --------------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'HydPy.tex', u'HydPy Documentation',
   u'Christoph Tyralla', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# If true, show page references after internal links.
#latex_show_pagerefs = False

# If true, show URL addresses after external links.
#latex_show_urls = False

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_domain_indices = True


# -- Options for manual page output --------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    ('index', 'hydpy', u'HydPy Documentation',
     [u'Christoph Tyralla'], 1)
]

# If true, show URL addresses after external links.
#man_show_urls = False


# -- Options for Texinfo output ------------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
  ('index', 'HydPy', u'HydPy Documentation',
   u'Christoph Tyralla', 'HydPy', 'One line description of project.',
   'Miscellaneous'),
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []

# If false, no module index is generated.
#texinfo_domain_indices = True

# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/__init__.py


      

      

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""
Version 1 of the HydPy-A model generalises the RIMO/RIDO flood routing
approach.

RIMO/RIDO is based on the `translation diffusion equation`, which is
a linear approximation on the Saint-Venant equations involving only
two parameters - one for the celerity and one for the diffusivity of
the flood wave.  The linearity of the approach allows for constructing
Unit Hydrograph ordinates for each specific combination of celerity,
diffusivity, and the length of the considered river section.  One can
understand these ordinates as coefficients of a moving average (MA)
process.

RIMO/RIDO adds two additional features to this conventional approach.

Firstly, RIMO/RIDO approximates the response function described by the
MA coefficients by an ARMA process, which is useful for response
functions with long tails.  Very often, autoregressive (AR) models are
capable of approximating long-tailed responses sufficiently with few
parameters.  Hence, using ARMA models (which reflect the rising limb
of a response function with their MA coefficients its falling limb
with their AR coefficients) is often more parameter efficient than
using pure MA models.

Secondly, RIMO/RIDO separates the flow into the river section into
different "portions" based on discharge threshold. Each portion is
routed by a separate ARMA model, allowing to factor in the nonlinearity
of rating curves to a certain degree.  For example, the bank-full
discharge can serve as a threshold.  Then one can apply smaller
celerity values and larger diffusivity values on the "upper" flow
portion to simulate retention processes on flood-plains.

If you want to apply |arma_v1| precisely like RIMO/RIDO, consider
using |TranslationDiffusionEquation| for calculating its coefficients.
But you are free to define other parameters, e.g. those of the
|LinearStorageCascade|. Additionally, you are free to apply combined
ARMA coefficients or pure MA coefficients only, as described in the
following examples.

Integration examples:

    The following tests are performed over a period of 20 hours:

    >>> from hydpy import pub, Timegrid, Timegrids, Nodes, Element
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000 00:00',
    ...                                    '01.01.2000 20:00',
    ...                                    '1h'))

    Import the model and define the time settings:

    >>> from hydpy.models.arma_v1 import *
    >>> parameterstep('1h')

    For testing purposes, the model input shall be retrieved from the nodes
    `input1` and `input2` and the model output shall be passed to node
    `output`.  Firstly, define all nodes:

    >>> nodes = Nodes('input1', 'input2', 'output')

    Define the element `stream` and build the connections between
    the nodes defined above and the |arma_v1| model instance:

    >>> stream = Element('stream',
    ...                  inlets=['input1', 'input2'],
    ...                  outlets='output')
    >>> stream.connect(model)

    Prepare a test function object, which prints the respective values
    of the model sequences |QIn|, |QPIn|, |QPOut|, and |QOut|.  The node
    sequence `sim` is added in order to prove that the values calculated
    for |QOut| are actually passed to `sim`:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.activated=(
    ...     fluxes.qin, fluxes.qout)
    >>> test = IntegrationTest(
    ...     stream,
    ...     seqs=(fluxes.qin, fluxes.qpin, fluxes.qpout,
    ...           fluxes.qout, nodes.output.sequences.sim))

    To start the respective example runs from stationary conditions, a
    base flow value of 2 m³/s is set for all values of the log sequences
    |LogIn| and |LogOut|:

    >>> test.inits = ((logs.login, 2.),
    ...               (logs.logout, 2.))

    Print just the time instead of the whole date:

    >>> test.dateformat = '%H:%M'

    Define two flood events, one for each lake inflow:

    >>> nodes.input1.sequences.sim.series = (
    ...     1., 1., 2., 4., 3., 2., 1., 1., 1., 1.,
    ...     1., 1., 1., 1., 1., 1., 1., 1., 1., 1.)
    >>> nodes.input2.sequences.sim.series = (
    ...     1., 2., 6., 9., 8., 6., 4., 3., 2., 1.,
    ...     1., 1., 1., 1., 1., 1., 1., 1., 1., 1.)

    In the first example, a pure fourth order moving avarage (MA) process is
    defined via the control parameter |Responses|:

    >>> responses(((), (0.2, 0.4, 0.3, 0.1)))

    This leads to a usual "unit hydrograph" convolution result, where all
    inflow "impulses" are separated onto the actual and the three subsequent
    time steps:

    >>> test('arma_v1_ex1')
    |  date |  qin | qpin | qpout | qout | output |
    -----------------------------------------------
    | 00:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 01:00 |  3.0 |  3.0 |   2.2 |  2.2 |    2.2 |
    | 02:00 |  8.0 |  8.0 |   3.6 |  3.6 |    3.6 |
    | 03:00 | 13.0 | 13.0 |   6.9 |  6.9 |    6.9 |
    | 04:00 | 11.0 | 11.0 |  10.1 | 10.1 |   10.1 |
    | 05:00 |  8.0 |  8.0 |  10.7 | 10.7 |   10.7 |
    | 06:00 |  5.0 |  5.0 |   8.8 |  8.8 |    8.8 |
    | 07:00 |  4.0 |  4.0 |   6.3 |  6.3 |    6.3 |
    | 08:00 |  3.0 |  3.0 |   4.5 |  4.5 |    4.5 |
    | 09:00 |  2.0 |  2.0 |   3.3 |  3.3 |    3.3 |
    | 10:00 |  2.0 |  2.0 |   2.5 |  2.5 |    2.5 |
    | 11:00 |  2.0 |  2.0 |   2.1 |  2.1 |    2.1 |
    | 12:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 13:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 14:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 15:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 16:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 17:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 18:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |
    | 19:00 |  2.0 |  2.0 |   2.0 |  2.0 |    2.0 |

    .. raw:: html

        <iframe
            src="arma_v1_ex1.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    In the second example, the mimimum order of the MA process is defined,
    which is one.  The autoregression (AR) process is of order two.  Note
    that negative AR coefficients are allowed (also note the opposite signs
    of the coefficients in contrast to the statistical literature):

    >>> responses(((1.1, -0.3), (0.2,)))

    Due to the AR process, the maximum time delay of some fractions of
    each input impulse is theoretically infinite:

    >>> test('arma_v1_ex2')
    |  date |  qin | qpin |    qpout |     qout |   output |
    --------------------------------------------------------
    | 00:00 |  2.0 |  2.0 |      2.0 |      2.0 |      2.0 |
    | 01:00 |  3.0 |  3.0 |      2.2 |      2.2 |      2.2 |
    | 02:00 |  8.0 |  8.0 |     3.42 |     3.42 |     3.42 |
    | 03:00 | 13.0 | 13.0 |    5.702 |    5.702 |    5.702 |
    | 04:00 | 11.0 | 11.0 |   7.4462 |   7.4462 |   7.4462 |
    | 05:00 |  8.0 |  8.0 |  8.08022 |  8.08022 |  8.08022 |
    | 06:00 |  5.0 |  5.0 | 7.654382 | 7.654382 | 7.654382 |
    | 07:00 |  4.0 |  4.0 | 6.795754 | 6.795754 | 6.795754 |
    | 08:00 |  3.0 |  3.0 | 5.779015 | 5.779015 | 5.779015 |
    | 09:00 |  2.0 |  2.0 |  4.71819 |  4.71819 |  4.71819 |
    | 10:00 |  2.0 |  2.0 | 3.856305 | 3.856305 | 3.856305 |
    | 11:00 |  2.0 |  2.0 | 3.226478 | 3.226478 | 3.226478 |
    | 12:00 |  2.0 |  2.0 | 2.792235 | 2.792235 | 2.792235 |
    | 13:00 |  2.0 |  2.0 | 2.503515 | 2.503515 | 2.503515 |
    | 14:00 |  2.0 |  2.0 | 2.316196 | 2.316196 | 2.316196 |
    | 15:00 |  2.0 |  2.0 | 2.196761 | 2.196761 | 2.196761 |
    | 16:00 |  2.0 |  2.0 | 2.121578 | 2.121578 | 2.121578 |
    | 17:00 |  2.0 |  2.0 | 2.074708 | 2.074708 | 2.074708 |
    | 18:00 |  2.0 |  2.0 | 2.045705 | 2.045705 | 2.045705 |
    | 19:00 |  2.0 |  2.0 | 2.027863 | 2.027863 | 2.027863 |

    .. raw:: html

        <iframe
            src="arma_v1_ex2.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    The third example equals the second one, except in the additional
    time delay of exactly one hour, due to the changed MA process:

    >>> responses(((1.1, -0.3), (0.0, 0.2)))

    >>> test('arma_v1_ex3')
    |  date |  qin | qpin |    qpout |     qout |   output |
    --------------------------------------------------------
    | 00:00 |  2.0 |  2.0 |      2.0 |      2.0 |      2.0 |
    | 01:00 |  3.0 |  3.0 |      2.0 |      2.0 |      2.0 |
    | 02:00 |  8.0 |  8.0 |      2.2 |      2.2 |      2.2 |
    | 03:00 | 13.0 | 13.0 |     3.42 |     3.42 |     3.42 |
    | 04:00 | 11.0 | 11.0 |    5.702 |    5.702 |    5.702 |
    | 05:00 |  8.0 |  8.0 |   7.4462 |   7.4462 |   7.4462 |
    | 06:00 |  5.0 |  5.0 |  8.08022 |  8.08022 |  8.08022 |
    | 07:00 |  4.0 |  4.0 | 7.654382 | 7.654382 | 7.654382 |
    | 08:00 |  3.0 |  3.0 | 6.795754 | 6.795754 | 6.795754 |
    | 09:00 |  2.0 |  2.0 | 5.779015 | 5.779015 | 5.779015 |
    | 10:00 |  2.0 |  2.0 |  4.71819 |  4.71819 |  4.71819 |
    | 11:00 |  2.0 |  2.0 | 3.856305 | 3.856305 | 3.856305 |
    | 12:00 |  2.0 |  2.0 | 3.226478 | 3.226478 | 3.226478 |
    | 13:00 |  2.0 |  2.0 | 2.792235 | 2.792235 | 2.792235 |
    | 14:00 |  2.0 |  2.0 | 2.503515 | 2.503515 | 2.503515 |
    | 15:00 |  2.0 |  2.0 | 2.316196 | 2.316196 | 2.316196 |
    | 16:00 |  2.0 |  2.0 | 2.196761 | 2.196761 | 2.196761 |
    | 17:00 |  2.0 |  2.0 | 2.121578 | 2.121578 | 2.121578 |
    | 18:00 |  2.0 |  2.0 | 2.074708 | 2.074708 | 2.074708 |
    | 19:00 |  2.0 |  2.0 | 2.045705 | 2.045705 | 2.045705 |

    .. raw:: html

        <iframe
            src="arma_v1_ex3.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    Be aware that neither parameter |Responses| does check the assigned
    coefficients nor does model |arma_v1| check the calculated outflow
    for plausibility (one can use the features provided in modules
    |iuhtools| and |armatools| to calculate reliable coefficients).
    The fourth example increases the span of the AR coefficients used
    in the third example.  The complete ARMA process is still mass
    conservative, but some response values of the recession curve
    are negative:


    >>> responses(((1.5, -0.7), (0.0, 0.2)))
    >>> test('arma_v1_ex4')
    |  date |  qin | qpin |     qpout |      qout |    output |
    -----------------------------------------------------------
    | 00:00 |  2.0 |  2.0 |       2.0 |       2.0 |       2.0 |
    | 01:00 |  3.0 |  3.0 |       2.0 |       2.0 |       2.0 |
    | 02:00 |  8.0 |  8.0 |       2.2 |       2.2 |       2.2 |
    | 03:00 | 13.0 | 13.0 |       3.5 |       3.5 |       3.5 |
    | 04:00 | 11.0 | 11.0 |      6.31 |      6.31 |      6.31 |
    | 05:00 |  8.0 |  8.0 |     9.215 |     9.215 |     9.215 |
    | 06:00 |  5.0 |  5.0 |   11.0055 |   11.0055 |   11.0055 |
    | 07:00 |  4.0 |  4.0 |  11.05775 |  11.05775 |  11.05775 |
    | 08:00 |  3.0 |  3.0 |  9.682775 |  9.682775 |  9.682775 |
    | 09:00 |  2.0 |  2.0 |  7.383738 |  7.383738 |  7.383738 |
    | 10:00 |  2.0 |  2.0 |  4.697664 |  4.697664 |  4.697664 |
    | 11:00 |  2.0 |  2.0 |  2.277879 |  2.277879 |  2.277879 |
    | 12:00 |  2.0 |  2.0 |  0.528454 |  0.528454 |  0.528454 |
    | 13:00 |  2.0 |  2.0 | -0.401834 | -0.401834 | -0.401834 |
    | 14:00 |  2.0 |  2.0 | -0.572669 | -0.572669 | -0.572669 |
    | 15:00 |  2.0 |  2.0 |  -0.17772 |  -0.17772 |  -0.17772 |
    | 16:00 |  2.0 |  2.0 |  0.534289 |  0.534289 |  0.534289 |
    | 17:00 |  2.0 |  2.0 |  1.325837 |  1.325837 |  1.325837 |
    | 18:00 |  2.0 |  2.0 |  2.014753 |  2.014753 |  2.014753 |
    | 19:00 |  2.0 |  2.0 |  2.494044 |  2.494044 |  2.494044 |

    .. raw:: html

        <iframe
            src="arma_v1_ex4.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    In the fifth example, the coefficients of the first two examples are
    combined.  For inflow discharges between 0 and 7 m³/s, the pure AR
    process is applied.  For inflow discharges exceeding 7 m³/s, inflow
    is separated.  The AR process is still applied on a portion of 7 m³/s,
    but for the inflow exceeding the threshold the mixed ARMA model is
    applied:

    >>> responses(_0=((), (0.2, 0.4, 0.3, 0.1)),
    ...           _7=((1.1, -0.3), (0.2,)))

    To again start from stationary conditions, one has to apply different
    values to both log sequences.  The base flow value of 2 m³/s is only
    given to the (low flow) MA model, the (high flow) ARMA model is
    initialized with zero values instead:

    >>> test.inits.login = [[2.0], [0.0]]
    >>> test.inits.logout = [[2.0], [0.0]]

    The separate handling of the inflow can be studied by inspecting the
    columns of sequence |QPIn| and sequence |QPOut|.  The respective left
    columns show the input and output of the MA model, the respective
    right colums show the input and output of the ARMA model:

    >>> test('arma_v1_ex5')
    |  date |  qin |      qpin |         qpout |     qout |   output |
    ------------------------------------------------------------------
    | 00:00 |  2.0 | 2.0   0.0 | 2.0       0.0 |      2.0 |      2.0 |
    | 01:00 |  3.0 | 3.0   0.0 | 2.2       0.0 |      2.2 |      2.2 |
    | 02:00 |  8.0 | 7.0   1.0 | 3.4       0.2 |      3.6 |      3.6 |
    | 03:00 | 13.0 | 7.0   6.0 | 5.3      1.42 |     6.72 |     6.72 |
    | 04:00 | 11.0 | 7.0   4.0 | 6.6     2.302 |    8.902 |    8.902 |
    | 05:00 |  8.0 | 7.0   1.0 | 7.0    2.3062 |   9.3062 |   9.3062 |
    | 06:00 |  5.0 | 5.0   0.0 | 6.6   1.84622 |  8.44622 |  8.44622 |
    | 07:00 |  4.0 | 4.0   0.0 | 5.6  1.338982 | 6.938982 | 6.938982 |
    | 08:00 |  3.0 | 3.0   0.0 | 4.4  0.919014 | 5.319014 | 5.319014 |
    | 09:00 |  2.0 | 2.0   0.0 | 3.3  0.609221 | 3.909221 | 3.909221 |
    | 10:00 |  2.0 | 2.0   0.0 | 2.5  0.394439 | 2.894439 | 2.894439 |
    | 11:00 |  2.0 | 2.0   0.0 | 2.1  0.251116 | 2.351116 | 2.351116 |
    | 12:00 |  2.0 | 2.0   0.0 | 2.0  0.157896 | 2.157896 | 2.157896 |
    | 13:00 |  2.0 | 2.0   0.0 | 2.0  0.098351 | 2.098351 | 2.098351 |
    | 14:00 |  2.0 | 2.0   0.0 | 2.0  0.060817 | 2.060817 | 2.060817 |
    | 15:00 |  2.0 | 2.0   0.0 | 2.0  0.037394 | 2.037394 | 2.037394 |
    | 16:00 |  2.0 | 2.0   0.0 | 2.0  0.022888 | 2.022888 | 2.022888 |
    | 17:00 |  2.0 | 2.0   0.0 | 2.0  0.013959 | 2.013959 | 2.013959 |
    | 18:00 |  2.0 | 2.0   0.0 | 2.0  0.008488 | 2.008488 | 2.008488 |
    | 19:00 |  2.0 | 2.0   0.0 | 2.0  0.005149 | 2.005149 | 2.005149 |

    .. raw:: html

        <iframe
            src="arma_v1_ex5.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>
"""

# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
# ...from arma
from hydpy.models.arma import arma_model
from hydpy.models.arma import arma_control
from hydpy.models.arma import arma_derived
from hydpy.models.arma import arma_fluxes
from hydpy.models.arma import arma_logs
from hydpy.models.arma import arma_inlets
from hydpy.models.arma import arma_outlets


class Model(modeltools.Model):
    """Rimo/Rido version of ARMA (arma_v1)."""

    _INLET_METHODS = (arma_model.pick_q_v1,)
    _RUN_METHODS = (arma_model.calc_qpin_v1,
                    arma_model.calc_login_v1,
                    arma_model.calc_qma_v1,
                    arma_model.calc_qar_v1,
                    arma_model.calc_qpout_v1,
                    arma_model.calc_logout_v1,
                    arma_model.calc_qout_v1)
    _OUTLET_METHODS = (arma_model.pass_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of arma_v1, directly defined by the user."""
    _PARCLASSES = (arma_control.Responses,)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of arma_v1, indirectly defined by the user."""
    _PARCLASSES = (arma_derived.Nmb,
                   arma_derived.MaxQ,
                   arma_derived.DiffQ,
                   arma_derived.AR_Order,
                   arma_derived.MA_Order,
                   arma_derived.AR_Coefs,
                   arma_derived.MA_Coefs)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of arma_v1"""
    _SEQCLASSES = (arma_fluxes.QIn,
                   arma_fluxes.QPIn,
                   arma_fluxes.QMA,
                   arma_fluxes.QAR,
                   arma_fluxes.QPOut,
                   arma_fluxes.QOut)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of arma_v1."""
    _SEQCLASSES = (arma_logs.LogIn,
                   arma_logs.LogOut)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of arma_v1."""
    _SEQCLASSES = (arma_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of arma_v1."""
    _SEQCLASSES = (arma_outlets.Q,)


autodoc_applicationmodel()


# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v001.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""Version 1 application model of HydPy-Dam.

|dam_v001| is supposed to represent a dam with an `active` low water
control scheme and a `passive` high water control scheme.

During low flow conditions, |dam_v001| tries to increase low runoff
values immediately downstream the dam and at a more remote location
in the river channel downstream.  This requires that |dam_v001| receives
information from downstream via a `receiver node`.  In order to achieve
a reliable drought control, |dam_v001| to store some low-flow related
information for a certain number of simulation steps.

During high flow conditions, |dam_v001| is controlled by two fixed
relationships: one between water volume and water level, the other
one between discharge and water level.

The differential equation of |dam_v001| is solved by an adaptive
Runge-Kutta solver that only works well on continuous equations.
This is one reason why most threshold based low-flow equations are
defined in a smoothed manner, and why an artificial neural network
is chosen to specify the relationship between discharge and waterlevel.
(Additionally, the smoothed equations allow for a finer, less abrupt
control of the dam.)  However, the proper (meaning realistic and
computational efficient) setting of the related smoothing and neural
network parameters might require some experience.  It seems advisable
to investigate the functioning of each new model parameterization on
a number of synthetic and/or measured drought events.

Note also that the applied solver is an explicite Runge-Kutta method,
which could increase computation times under stiffness.  Due to to
the adaptive order and stepsize control, inaccurate results due to
stability issues should be excluded.  But for very responsive dams
increased computations times are to be expected.  This is explained
in some detail at the end of this section.


Integration examples:

    The following examples are performed over a period of 20 days:

    >>> from hydpy import pub, Timegrid, Timegrids
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '21.01.2000',
    ...                                    '1d'))

    The first examples are supposed to demonstrate how drought events at a
    cross section far downstream are reduced by the corresponding methods of
    the dam model under different configurations.  To show this in a
    realistic manner, a relatively complex setting is required.  We will
    make use of the |arma_v1| application model.  This model will be used
    to route the outflow of the dam to the cross section under investigation
    and add some `natural` discharge of the subcatchment between the dam
    and the cross section (a picture would be helpful).

    We define four nodes.  The `input` node is used to define the inflow into
    the dam and the `natural` node is used to define the additional discharge
    of the subcatchment.  The `output` node receives the (unmodified) outflow
    out of dam and the `remote` node receives both the routed outflow of the
    dam and the additional discharge of the subcatchment:

    >>> from hydpy import Node
    >>> input_ = Node('input')
    >>> output = Node('output')
    >>> natural = Node('natural')
    >>> remote = Node('remote')

    These nodes are used to connect the following three elements.  There is
    one element for handling the |dam| model and there are two elements for
    handling different `stream` models.  The model of element `stream1` is
    supposed to route the outflow of the dam model with significant delay
    and the model of element `stream2` is supposed to directly pass the
    discharge of the subcatchment:

    >>> from hydpy import Element
    >>> dam = Element('dam', inlets=input_, outlets=output, receivers=remote)
    >>> stream1 = Element('stream1', inlets=output, outlets=remote)
    >>> stream2 = Element('stream2', inlets=natural, outlets=remote)

    Now the models can be prepared.  We begin with the `stream2` model.
    By setting the |arma_control.Responses| parameter in the following
    manner we define a pure Moving Average model that neither results
    in translation nor retention processes:

    >>> from hydpy import prepare_model
    >>> from hydpy.models import arma_v1
    >>> arma_model = prepare_model(arma_v1)
    >>> stream2.connect(arma_model)
    >>> arma_model.parameters.control.responses(((), (1.0,)))
    >>> arma_model.parameters.update()

    The second stream model is also configured as pure Moving Average model
    but with a time delay of 1.8 days:

    >>> arma_model = prepare_model(arma_v1)
    >>> stream1.connect(arma_model)
    >>> arma_model.parameters.control.responses(((), (0.2, 0.4, 0.3, 0.1)))
    >>> arma_model.parameters.update()
    >>> arma_model.sequences.logs.login = 0.0

    Last but not least, the dam model is initialized and handed over to its
    the `dam` element (different sets of parameters will be defined in the
    examples below):

    >>> from hydpy.models.dam_v001 import *
    >>> parameterstep('1d')
    >>> dam.connect(model)

    To execute the following examples conveniently, a test function object
    is prepared:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.activated=(
    ...     fluxes.inflow, fluxes.outflow)
    >>> test = IntegrationTest(
    ...     dam,
    ...     inits=((states.watervolume, 0.0),
    ...            (logs.loggedtotalremotedischarge, 1.9),
    ...            (logs.loggedoutflow, 0.0),
    ...            (stream1.model.sequences.logs.login, 0.0)))
    >>> test.dateformat = '%d.%m.'

    Next the drought event needs to be defined.  The natural discharge of
    the subcatchment decreases constantly for 9 days, than stays at constant
    level of 1 m³/s for 4 days, and finally increases constantly again:

    >>> natural.sequences.sim.series = [
    ...         1.8, 1.7, 1.6, 1.5, 1.4, 1.3, 1.2, 1.1, 1.0, 1.0,
    ...         1.0, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]

    The inflow into the dam is assumened to remain constant for the whole
    simulation period:

    >>> input_.sequences.sim.series = 1.0

    Finally, we can set the parameter values of the dam model.  For the sake
    of simplicity, the relationship between water level and volume is assumed
    to be linear in the range relevant for the following examples (between
    0 to 25 m or 0 to 1e8 m³).  This is approximately true if with the
    following configuration of the |WaterVolume2WaterLevel| parameter:

    >>> watervolume2waterlevel(
    ...         weights_input=1e-6, weights_output=1e6,
    ...         intercepts_hidden=0.0, intercepts_output=-1e6/2)
    >>> # This plot confirms the linearity of the defined relationship:
    >>> watervolume2waterlevel.plot(0.0, 100.0)

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    To focus on the drought related algorithms solely we turn of the flood
    related processes.  This is accomplished by setting the weights and
    intercepts of the |WaterLevel2FloodDischarge| to zero:

    >>> waterlevel2flooddischarge(ann(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0))
    >>> waterlevel2flooddischarge.plot(0.0, 25.0)

    .. testsetup::

        >>> pyplot.close()

    To confirm that the whole scenario is properly aranged, we also turn of
    of the drought related methods at first:

    >>> nmblogentries(1)
    >>> remotedischargeminimum(0.0)
    >>> remotedischargesafety(0.0)
    >>> neardischargeminimumthreshold(0.0)
    >>> neardischargeminimumtolerance(0.0)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)

    Also, we have to define the area of the catchment draining into the dam.
    The information is required for adjusting the numerical local truncation
    error only.  For a catchment area of 86.4 km² the general local truncation
    error (in mm per simulation step) is identical with the actually applied
    site specific local truncation error (in m³/s):

    >>> catchmentarea(86.4)
    >>> from hydpy import round_
    >>> round_(solver.abserrormax.INIT)
    0.01
    >>> parameters.update()
    >>> solver.abserrormax
    abserrormax(0.01)

    If not stated otherwise, we enable the |RestrictTargetedRelease| option
    flag in the following examples:

    >>> restricttargetedrelease(True)

    .. _dam_v001_ex01:

    **Example 1**

    The following table confirms that the dam model does not release any
    discharge (row `output` contains zero values only).  Hence the
    discharge at the cross section downstream (row `remote`) is identical
    with the discharge of the subcatchment (row `natural`):

    >>> test('dam_v001_ex1')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge | outflow | watervolume | input | natural | output | remote |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                  1.8 |                    1.9 |          0.0 |          -1.9 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.0864 |   1.0 |     1.8 |    0.0 |    1.8 |
    | 02.01. |    1.0 |                  1.7 |                    1.8 |          0.0 |          -1.8 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.1728 |   1.0 |     1.7 |    0.0 |    1.7 |
    | 03.01. |    1.0 |                  1.6 |                    1.7 |          0.0 |          -1.7 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.2592 |   1.0 |     1.6 |    0.0 |    1.6 |
    | 04.01. |    1.0 |                  1.5 |                    1.6 |          0.0 |          -1.6 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.3456 |   1.0 |     1.5 |    0.0 |    1.5 |
    | 05.01. |    1.0 |                  1.4 |                    1.5 |          0.0 |          -1.5 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |       0.432 |   1.0 |     1.4 |    0.0 |    1.4 |
    | 06.01. |    1.0 |                  1.3 |                    1.4 |          0.0 |          -1.4 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.5184 |   1.0 |     1.3 |    0.0 |    1.3 |
    | 07.01. |    1.0 |                  1.2 |                    1.3 |          0.0 |          -1.3 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.6048 |   1.0 |     1.2 |    0.0 |    1.2 |
    | 08.01. |    1.0 |                  1.1 |                    1.2 |          0.0 |          -1.2 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.6912 |   1.0 |     1.1 |    0.0 |    1.1 |
    | 09.01. |    1.0 |                  1.0 |                    1.1 |          0.0 |          -1.1 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.7776 |   1.0 |     1.0 |    0.0 |    1.0 |
    | 10.01. |    1.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |       0.864 |   1.0 |     1.0 |    0.0 |    1.0 |
    | 11.01. |    1.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      0.9504 |   1.0 |     1.0 |    0.0 |    1.0 |
    | 12.01. |    1.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.0368 |   1.0 |     1.0 |    0.0 |    1.0 |
    | 13.01. |    1.0 |                  1.1 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.1232 |   1.0 |     1.1 |    0.0 |    1.1 |
    | 14.01. |    1.0 |                  1.2 |                    1.1 |          0.0 |          -1.1 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.2096 |   1.0 |     1.2 |    0.0 |    1.2 |
    | 15.01. |    1.0 |                  1.3 |                    1.2 |          0.0 |          -1.2 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |       1.296 |   1.0 |     1.3 |    0.0 |    1.3 |
    | 16.01. |    1.0 |                  1.4 |                    1.3 |          0.0 |          -1.3 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.3824 |   1.0 |     1.4 |    0.0 |    1.4 |
    | 17.01. |    1.0 |                  1.5 |                    1.4 |          0.0 |          -1.4 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.4688 |   1.0 |     1.5 |    0.0 |    1.5 |
    | 18.01. |    1.0 |                  1.6 |                    1.5 |          0.0 |          -1.5 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.5552 |   1.0 |     1.6 |    0.0 |    1.6 |
    | 19.01. |    1.0 |                  1.7 |                    1.6 |          0.0 |          -1.6 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |      1.6416 |   1.0 |     1.7 |    0.0 |    1.7 |
    | 20.01. |    1.0 |                  1.8 |                    1.7 |          0.0 |          -1.7 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |     0.0 |       1.728 |   1.0 |     1.8 |    0.0 |    1.8 |

    .. raw:: html

        <iframe
            src="dam_v001_ex1.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex02:

    **Example 2**

    Next the discharge that should not be undercut at the cross section
    downstream is set to 1.4 m³/s:

    >>> remotedischargeminimum(1.4)

    The dam model decreases the drought but is not very successful in
    doing so.  The lowest discharge at the cross section is increased from
    1 m³/s to approximately 1.2 m³/s in the beginning of the event, which
    is still below the threshold value of 1.4 m³/s.  Furthermore, in the
    second half of the event too much discharge is released.  On January 12,
    the discharge at the cross section is increased from 1 m³/s to
    approximately 1.6 m³/s:

    >>> test('dam_v001_ex2')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                  1.8 |                    1.9 |          0.0 |          -0.5 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.0864 |   1.0 |     1.8 |      0.0 |      1.8 |
    | 02.01. |    1.0 |                  1.7 |                    1.8 |          0.0 |          -0.4 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.1728 |   1.0 |     1.7 |      0.0 |      1.7 |
    | 03.01. |    1.0 |                  1.6 |                    1.7 |          0.0 |          -0.3 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.2592 |   1.0 |     1.6 |      0.0 |      1.6 |
    | 04.01. |    1.0 |                  1.5 |                    1.6 |          0.0 |          -0.2 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.3456 |   1.0 |     1.5 |      0.0 |      1.5 |
    | 05.01. |    1.0 |                  1.4 |                    1.5 |          0.0 |          -0.1 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |       0.432 |   1.0 |     1.4 |      0.0 |      1.4 |
    | 06.01. |    1.0 |                  1.3 |                    1.4 |          0.0 |           0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.5184 |   1.0 |     1.3 |      0.0 |      1.3 |
    | 07.01. |    1.0 |                 1.22 |                    1.3 |          0.1 |           0.1 |                   0.1 |             0.1 |             0.1 |           0.1 |            0.0 |      0.1 |     0.59616 |   1.0 |     1.2 |      0.1 |     1.22 |
    | 08.01. |    1.0 |                1.196 |                   1.12 |         0.28 |          0.18 |                  0.28 |            0.28 |            0.28 |          0.28 |            0.0 |     0.28 |    0.658368 |   1.0 |     1.1 |     0.28 |    1.196 |
    | 09.01. |    1.0 |               1.2388 |                  0.916 |        0.484 |         0.204 |                 0.484 |           0.484 |           0.484 |         0.484 |            0.0 |    0.484 |     0.70295 |   1.0 |     1.0 |    0.484 |   1.2388 |
    | 10.01. |    1.0 |              1.41664 |                 0.7548 |       0.6452 |        0.1612 |                0.6452 |          0.6452 |          0.6452 |        0.6452 |            0.0 |   0.6452 |    0.733605 |   1.0 |     1.0 |   0.6452 |  1.41664 |
    | 11.01. |    1.0 |             1.556992 |                0.77144 |      0.62856 |      -0.01664 |               0.62856 |         0.62856 |         0.62856 |       0.62856 |            0.0 |  0.62856 |    0.765698 |   1.0 |     1.0 |  0.62856 | 1.556992 |
    | 12.01. |    1.0 |             1.587698 |               0.928432 |     0.471568 |     -0.156992 |              0.471568 |        0.471568 |        0.471568 |      0.471568 |            0.0 | 0.471568 |    0.811354 |   1.0 |     1.0 | 0.471568 | 1.587698 |
    | 13.01. |    1.0 |             1.598489 |                1.11613 |      0.28387 |     -0.187698 |               0.28387 |         0.28387 |         0.28387 |       0.28387 |            0.0 |  0.28387 |    0.873228 |   1.0 |     1.1 |  0.28387 | 1.598489 |
    | 14.01. |    1.0 |             1.534951 |               1.314619 |     0.085381 |     -0.198489 |              0.085381 |        0.085381 |        0.085381 |      0.085381 |            0.0 | 0.085381 |    0.952251 |   1.0 |     1.2 | 0.085381 | 1.534951 |
    | 15.01. |    1.0 |              1.46647 |                1.44957 |          0.0 |     -0.134951 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.038651 |   1.0 |     1.3 |      0.0 |  1.46647 |
    | 16.01. |    1.0 |             1.454001 |                1.46647 |          0.0 |      -0.06647 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.125051 |   1.0 |     1.4 |      0.0 | 1.454001 |
    | 17.01. |    1.0 |             1.508538 |               1.454001 |          0.0 |     -0.054001 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.211451 |   1.0 |     1.5 |      0.0 | 1.508538 |
    | 18.01. |    1.0 |                  1.6 |               1.508538 |          0.0 |     -0.108538 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.297851 |   1.0 |     1.6 |      0.0 |      1.6 |
    | 19.01. |    1.0 |                  1.7 |                    1.6 |          0.0 |          -0.2 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.384251 |   1.0 |     1.7 |      0.0 |      1.7 |
    | 20.01. |    1.0 |                  1.8 |                    1.7 |          0.0 |          -0.3 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.470651 |   1.0 |     1.8 |      0.0 |      1.8 |

    .. raw:: html

        <iframe
            src="dam_v001_ex2.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex03:

    **Example 3**

    The qualified success in the example above is due to the time delay
    of the information flow from the cross section to the dam and, more
    importantly, due to the travel time of the discharge released.
    A simple strategy to increase reliability would be to set a higher
    value for parameter |RemoteDischargeMinimum|, e.g.:

    >>> remotedischargeminimum(1.6)

    Now there is only a small violation of threshold value on January, 6:

    >>> test('dam_v001_ex3')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                  1.8 |                    1.9 |          0.0 |          -0.3 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.0864 |   1.0 |     1.8 |      0.0 |      1.8 |
    | 02.01. |    1.0 |                  1.7 |                    1.8 |          0.0 |          -0.2 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.1728 |   1.0 |     1.7 |      0.0 |      1.7 |
    | 03.01. |    1.0 |                  1.6 |                    1.7 |          0.0 |          -0.1 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.2592 |   1.0 |     1.6 |      0.0 |      1.6 |
    | 04.01. |    1.0 |                  1.5 |                    1.6 |          0.0 |           0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |      0.3456 |   1.0 |     1.5 |      0.0 |      1.5 |
    | 05.01. |    1.0 |                 1.42 |                    1.5 |          0.1 |           0.1 |                   0.1 |             0.1 |             0.1 |           0.1 |            0.0 |      0.1 |     0.42336 |   1.0 |     1.4 |      0.1 |     1.42 |
    | 06.01. |    1.0 |                1.396 |                   1.32 |         0.28 |          0.18 |                  0.28 |            0.28 |            0.28 |          0.28 |            0.0 |     0.28 |    0.485568 |   1.0 |     1.3 |     0.28 |    1.396 |
    | 07.01. |    1.0 |               1.4388 |                  1.116 |        0.484 |         0.204 |                 0.484 |           0.484 |           0.484 |         0.484 |            0.0 |    0.484 |     0.53015 |   1.0 |     1.2 |    0.484 |   1.4388 |
    | 08.01. |    1.0 |              1.51664 |                 0.9548 |       0.6452 |        0.1612 |                0.6452 |          0.6452 |          0.6452 |        0.6452 |            0.0 |   0.6452 |    0.560805 |   1.0 |     1.1 |   0.6452 |  1.51664 |
    | 09.01. |    1.0 |             1.576992 |                0.87144 |      0.72856 |       0.08336 |               0.72856 |         0.72856 |         0.72856 |       0.72856 |            0.0 |  0.72856 |    0.584258 |   1.0 |     1.0 |  0.72856 | 1.576992 |
    | 10.01. |    1.0 |             1.683698 |               0.848432 |     0.751568 |      0.023008 |              0.751568 |        0.751568 |        0.751568 |      0.751568 |            0.0 | 0.751568 |    0.605722 |   1.0 |     1.0 | 0.751568 | 1.683698 |
    | 11.01. |    1.0 |             1.717289 |                0.93213 |      0.66787 |     -0.083698 |               0.66787 |         0.66787 |         0.66787 |       0.66787 |            0.0 |  0.66787 |    0.634418 |   1.0 |     1.0 |  0.66787 | 1.717289 |
    | 12.01. |    1.0 |             1.675591 |               1.049419 |     0.550581 |     -0.117289 |              0.550581 |        0.550581 |        0.550581 |      0.550581 |            0.0 | 0.550581 |    0.673248 |   1.0 |     1.0 | 0.550581 | 1.675591 |
    | 13.01. |    1.0 |             1.690748 |                1.12501 |      0.47499 |     -0.075591 |               0.47499 |         0.47499 |         0.47499 |       0.47499 |            0.0 |  0.47499 |    0.718609 |   1.0 |     1.1 |  0.47499 | 1.690748 |
    | 14.01. |    1.0 |             1.698806 |               1.215758 |     0.384242 |     -0.090748 |              0.384242 |        0.384242 |        0.384242 |      0.384242 |            0.0 | 0.384242 |     0.77181 |   1.0 |     1.2 | 0.384242 | 1.698806 |
    | 15.01. |    1.0 |             1.708339 |               1.314564 |     0.285436 |     -0.098806 |              0.285436 |        0.285436 |        0.285436 |      0.285436 |            0.0 | 0.285436 |    0.833549 |   1.0 |     1.3 | 0.285436 | 1.708339 |
    | 16.01. |    1.0 |             1.712365 |               1.422903 |     0.177097 |     -0.108339 |              0.177097 |        0.177097 |        0.177097 |      0.177097 |            0.0 | 0.177097 |    0.904647 |   1.0 |     1.4 | 0.177097 | 1.712365 |
    | 17.01. |    1.0 |              1.70784 |               1.535269 |     0.064731 |     -0.112365 |              0.064731 |        0.064731 |        0.064731 |      0.064731 |            0.0 | 0.064731 |    0.985455 |   1.0 |     1.5 | 0.064731 |  1.70784 |
    | 18.01. |    1.0 |             1.707565 |               1.643109 |          0.0 |      -0.10784 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.071855 |   1.0 |     1.6 |      0.0 | 1.707565 |
    | 19.01. |    1.0 |             1.737129 |               1.707565 |          0.0 |     -0.107565 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.158255 |   1.0 |     1.7 |      0.0 | 1.737129 |
    | 20.01. |    1.0 |             1.806473 |               1.737129 |          0.0 |     -0.137129 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |    1.244655 |   1.0 |     1.8 |      0.0 | 1.806473 |

    .. raw:: html

        <iframe
            src="dam_v001_ex3.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex04:

    **Example 4**

    While is is possible to simply increase the value of parameter
    |RemoteDischargeMinimum|, it is often advisable to use parameter
    |RemoteDischargeSafety| instead:

    >>> remotedischargeminimum(1.4)
    >>> remotedischargesafety(0.5)

    Under this configuration, the threshold value is exceeded at each
    simulation time step.  Additionally, the final storage content of
    the dam is about 4 % higher than in the last example, meaning the
    available water has been used more efficiently:

    >>> test('dam_v001_ex4')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |              1.80075 |                    1.9 |          0.0 |          -0.5 |                 0.005 |           0.005 |           0.005 |       0.00375 |            0.0 |  0.00375 |    0.086076 |   1.0 |     1.8 |  0.00375 |  1.80075 |
    | 02.01. |    1.0 |             1.703953 |                  1.797 |          0.0 |      -0.40075 |              0.012265 |        0.012265 |        0.012265 |      0.012265 |            0.0 | 0.012265 |    0.171416 |   1.0 |     1.7 | 0.012265 | 1.703953 |
    | 03.01. |    1.0 |             1.611799 |               1.691688 |          0.0 |     -0.303953 |              0.028841 |        0.028841 |        0.028841 |      0.028841 |            0.0 | 0.028841 |    0.255324 |   1.0 |     1.6 | 0.028841 | 1.611799 |
    | 04.01. |    1.0 |             1.528085 |               1.582958 |          0.0 |     -0.211799 |              0.062468 |        0.062468 |        0.062468 |      0.062468 |            0.0 | 0.062468 |    0.336327 |   1.0 |     1.5 | 0.062468 | 1.528085 |
    | 05.01. |    1.0 |             1.458423 |               1.465616 |          0.0 |     -0.128085 |              0.117784 |        0.117784 |        0.117784 |      0.117784 |            0.0 | 0.117784 |    0.412551 |   1.0 |     1.4 | 0.117784 | 1.458423 |
    | 06.01. |    1.0 |             1.417501 |               1.340639 |     0.059361 |     -0.058423 |              0.243813 |        0.243813 |        0.243813 |      0.243813 |            0.0 | 0.243813 |    0.477885 |   1.0 |     1.3 | 0.243813 | 1.417501 |
    | 07.01. |    1.0 |             1.430358 |               1.173688 |     0.226312 |     -0.017501 |              0.456251 |        0.456251 |        0.456251 |      0.456251 |            0.0 | 0.456251 |    0.524865 |   1.0 |     1.2 | 0.456251 | 1.430358 |
    | 08.01. |    1.0 |             1.495671 |               0.974107 |     0.425893 |     -0.030358 |              0.641243 |        0.641243 |        0.641243 |      0.641243 |            0.0 | 0.641243 |    0.555862 |   1.0 |     1.1 | 0.641243 | 1.495671 |
    | 09.01. |    1.0 |             1.556202 |               0.854428 |     0.545572 |     -0.095671 |              0.692239 |        0.692239 |        0.692239 |      0.692239 |            0.0 | 0.692239 |    0.582452 |   1.0 |     1.0 | 0.692239 | 1.556202 |
    | 10.01. |    1.0 |             1.641325 |               0.863962 |     0.536038 |     -0.156202 |              0.632157 |        0.632157 |        0.632157 |      0.632157 |            0.0 | 0.632157 |    0.614234 |   1.0 |     1.0 | 0.632157 | 1.641325 |
    | 11.01. |    1.0 |             1.612641 |               1.009168 |     0.390832 |     -0.241325 |              0.439912 |        0.439912 |        0.439912 |      0.439912 |            0.0 | 0.439912 |    0.662625 |   1.0 |     1.0 | 0.439912 | 1.612641 |
    | 12.01. |    1.0 |             1.492699 |               1.172729 |     0.227271 |     -0.212641 |              0.289317 |        0.289317 |        0.289317 |      0.289317 |            0.0 | 0.289317 |    0.724028 |   1.0 |     1.0 | 0.289317 | 1.492699 |
    | 13.01. |    1.0 |             1.480143 |               1.203382 |     0.196618 |     -0.092699 |              0.346132 |        0.346132 |        0.346132 |      0.346132 |            0.0 | 0.346132 |    0.780523 |   1.0 |     1.1 | 0.346132 | 1.480143 |
    | 14.01. |    1.0 |             1.554814 |                1.13401 |      0.26599 |     -0.080143 |              0.427871 |        0.427871 |        0.427871 |      0.427871 |            0.0 | 0.427871 |    0.829954 |   1.0 |     1.2 | 0.427871 | 1.554814 |
    | 15.01. |    1.0 |             1.677954 |               1.126942 |     0.273058 |     -0.154814 |              0.370171 |        0.370171 |        0.370171 |      0.370171 |            0.0 | 0.370171 |    0.884372 |   1.0 |     1.3 | 0.370171 | 1.677954 |
    | 16.01. |    1.0 |             1.736699 |               1.307783 |     0.092217 |     -0.277954 |               0.12828 |         0.12828 |         0.12828 |       0.12828 |            0.0 |  0.12828 |    0.959688 |   1.0 |     1.4 |  0.12828 | 1.736699 |
    | 17.01. |    1.0 |             1.709485 |               1.608419 |          0.0 |     -0.336699 |              0.021671 |        0.021671 |        0.021671 |      0.021671 |            0.0 | 0.021671 |    1.044216 |   1.0 |     1.5 | 0.021671 | 1.709485 |
    | 18.01. |    1.0 |             1.689667 |               1.687814 |          0.0 |     -0.309485 |               0.02749 |         0.02749 |         0.02749 |       0.02749 |            0.0 |  0.02749 |    1.128241 |   1.0 |     1.6 |  0.02749 | 1.689667 |
    | 19.01. |    1.0 |              1.73685 |               1.662178 |          0.0 |     -0.289667 |              0.032623 |        0.032623 |        0.032623 |      0.032623 |            0.0 | 0.032623 |    1.211822 |   1.0 |     1.7 | 0.032623 |  1.73685 |
    | 20.01. |    1.0 |             1.827792 |               1.704227 |          0.0 |      -0.33685 |              0.021642 |        0.021642 |        0.021642 |      0.021642 |            0.0 | 0.021642 |    1.296352 |   1.0 |     1.8 | 0.021642 | 1.827792 |

    .. raw:: html

        <iframe
            src="dam_v001_ex4.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex05:

    **Example 5**

    Building upon the last example, we subsequently increase the complexity
    of the model parameterization.  Firstly, we introduce a required minimum
    water release of 0.2 m³/s:

    >>> neardischargeminimumthreshold(0.2)

    Now there is also a relevant water release before and after the drought
    event occurs:

    >>> test('dam_v001_ex5')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.838333 |                    1.9 |          0.0 |          -0.5 |                 0.005 |             0.2 |             0.2 |      0.191667 |            0.0 | 0.191667 |     0.06984 |   1.0 |     1.8 | 0.191667 | 1.838333 |
    | 02.01. |    1.0 |             1.816667 |               1.646667 |          0.0 |     -0.438333 |              0.008746 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.13896 |   1.0 |     1.7 |      0.2 | 1.816667 |
    | 03.01. |    1.0 |               1.7775 |               1.616667 |          0.0 |     -0.416667 |              0.010632 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.20808 |   1.0 |     1.6 |      0.2 |   1.7775 |
    | 04.01. |    1.0 |             1.699167 |                 1.5775 |          0.0 |       -0.3775 |              0.015099 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |      0.2772 |   1.0 |     1.5 |      0.2 | 1.699167 |
    | 05.01. |    1.0 |                  1.6 |               1.499167 |          0.0 |     -0.299167 |               0.03006 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.34632 |   1.0 |     1.4 |      0.2 |      1.6 |
    | 06.01. |    1.0 |                  1.5 |                    1.4 |          0.0 |          -0.2 |              0.068641 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.41544 |   1.0 |     1.3 |      0.2 |      1.5 |
    | 07.01. |    1.0 |             1.408516 |                    1.3 |          0.1 |          -0.1 |              0.242578 |        0.242578 |        0.242578 |      0.242578 |            0.0 | 0.242578 |    0.480881 |   1.0 |     1.2 | 0.242578 | 1.408516 |
    | 08.01. |    1.0 |             1.371888 |               1.165937 |     0.234063 |     -0.008516 |              0.474285 |        0.474285 |        0.474285 |      0.474285 |            0.0 | 0.474285 |    0.526303 |   1.0 |     1.1 | 0.474285 | 1.371888 |
    | 09.01. |    1.0 |              1.43939 |               0.897603 |     0.502397 |      0.028112 |              0.784512 |        0.784512 |        0.784512 |      0.784512 |            0.0 | 0.784512 |    0.544921 |   1.0 |     1.0 | 0.784512 |  1.43939 |
    | 10.01. |    1.0 |              1.67042 |               0.654878 |     0.745122 |      -0.03939 |               0.95036 |         0.95036 |         0.95036 |       0.95036 |            0.0 |  0.95036 |     0.54921 |   1.0 |     1.0 |  0.95036 |  1.67042 |
    | 11.01. |    1.0 |             1.806604 |               0.720061 |     0.679939 |      -0.27042 |               0.71839 |         0.71839 |         0.71839 |       0.71839 |            0.0 |  0.71839 |    0.573541 |   1.0 |     1.0 |  0.71839 | 1.806604 |
    | 12.01. |    1.0 |               1.7156 |               1.088214 |     0.311786 |     -0.406604 |              0.323424 |        0.323424 |        0.323424 |      0.323424 |            0.0 | 0.323424 |    0.631997 |   1.0 |     1.0 | 0.323424 |   1.7156 |
    | 13.01. |    1.0 |             1.579922 |               1.392176 |     0.007824 |       -0.3156 |               0.03389 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.701117 |   1.0 |     1.1 |      0.2 | 1.579922 |
    | 14.01. |    1.0 |             1.488866 |               1.379922 |     0.020078 |     -0.179922 |              0.100394 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.770237 |   1.0 |     1.2 |      0.2 | 1.488866 |
    | 15.01. |    1.0 |             1.525216 |               1.288866 |     0.111134 |     -0.088866 |              0.264366 |        0.264366 |        0.264366 |      0.264366 |            0.0 | 0.264366 |    0.833796 |   1.0 |     1.3 | 0.264366 | 1.525216 |
    | 16.01. |    1.0 |             1.637612 |               1.260849 |     0.139151 |     -0.125216 |              0.259326 |        0.259326 |        0.259326 |      0.259326 |            0.0 | 0.259326 |     0.89779 |   1.0 |     1.4 | 0.259326 | 1.637612 |
    | 17.01. |    1.0 |              1.74304 |               1.378286 |     0.021714 |     -0.237612 |              0.072326 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.96691 |   1.0 |     1.5 |      0.2 |  1.74304 |
    | 18.01. |    1.0 |             1.824234 |                1.54304 |          0.0 |      -0.34304 |              0.020494 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     1.03603 |   1.0 |     1.6 |      0.2 | 1.824234 |
    | 19.01. |    1.0 |             1.905933 |               1.624234 |          0.0 |     -0.424234 |              0.009932 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     1.10515 |   1.0 |     1.7 |      0.2 | 1.905933 |
    | 20.01. |    1.0 |                  2.0 |               1.705933 |          0.0 |     -0.505933 |              0.004737 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     1.17427 |   1.0 |     1.8 |      0.2 |      2.0 |

    .. raw:: html

        <iframe
            src="dam_v001_ex5.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex06:

    **Example 6**

    One may have noted that the water release is only 0.19 m³/s instead
    of 0.2 m³/s on January 1.  This is due to the low local truncation
    error of 1e-2 m³/s in combination with the fact that the simulation
    starts with an completely dry dam. To confirm this, the required
    numerical accuracy is increased temporarily:

    >>> solver.abserrormax(1e-6)

    Now there is only a tiny deviation left in the last shown digit:

    >>> test('dam_v001_ex6')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 1.84 |                    1.9 |          0.0 |          -0.5 |                 0.005 |             0.2 |             0.2 |      0.199998 |            0.0 | 0.199998 |     0.06912 |   1.0 |     1.8 | 0.199998 |     1.84 |
    | 02.01. |    1.0 |             1.819999 |               1.640002 |          0.0 |         -0.44 |              0.008615 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.13824 |   1.0 |     1.7 |      0.2 | 1.819999 |
    | 03.01. |    1.0 |             1.779999 |               1.619999 |          0.0 |     -0.419999 |              0.010318 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.20736 |   1.0 |     1.6 |      0.2 | 1.779999 |
    | 04.01. |    1.0 |                  1.7 |               1.579999 |          0.0 |     -0.379999 |              0.014766 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.27648 |   1.0 |     1.5 |      0.2 |      1.7 |
    | 05.01. |    1.0 |                  1.6 |                    1.5 |          0.0 |          -0.3 |              0.029844 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |      0.3456 |   1.0 |     1.4 |      0.2 |      1.6 |
    | 06.01. |    1.0 |                  1.5 |                    1.4 |          0.0 |          -0.2 |              0.068641 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.41472 |   1.0 |     1.3 |      0.2 |      1.5 |
    | 07.01. |    1.0 |             1.408516 |                    1.3 |          0.1 |          -0.1 |              0.242578 |        0.242578 |        0.242578 |      0.242578 |            0.0 | 0.242578 |    0.480161 |   1.0 |     1.2 | 0.242578 | 1.408516 |
    | 08.01. |    1.0 |             1.371888 |               1.165937 |     0.234063 |     -0.008516 |              0.474285 |        0.474285 |        0.474285 |      0.474285 |            0.0 | 0.474285 |    0.525583 |   1.0 |     1.1 | 0.474285 | 1.371888 |
    | 09.01. |    1.0 |              1.43939 |               0.897603 |     0.502397 |      0.028112 |              0.784512 |        0.784512 |        0.784512 |      0.784512 |            0.0 | 0.784512 |    0.544201 |   1.0 |     1.0 | 0.784512 |  1.43939 |
    | 10.01. |    1.0 |              1.67042 |               0.654878 |     0.745122 |      -0.03939 |               0.95036 |         0.95036 |         0.95036 |       0.95036 |            0.0 |  0.95036 |     0.54849 |   1.0 |     1.0 |  0.95036 |  1.67042 |
    | 11.01. |    1.0 |             1.806604 |               0.720061 |     0.679939 |      -0.27042 |               0.71839 |         0.71839 |         0.71839 |       0.71839 |            0.0 |  0.71839 |    0.572821 |   1.0 |     1.0 |  0.71839 | 1.806604 |
    | 12.01. |    1.0 |               1.7156 |               1.088214 |     0.311786 |     -0.406604 |              0.323424 |        0.323424 |        0.323424 |      0.323424 |            0.0 | 0.323424 |    0.631278 |   1.0 |     1.0 | 0.323424 |   1.7156 |
    | 13.01. |    1.0 |             1.579922 |               1.392176 |     0.007824 |       -0.3156 |               0.03389 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.700398 |   1.0 |     1.1 |      0.2 | 1.579922 |
    | 14.01. |    1.0 |             1.488866 |               1.379922 |     0.020078 |     -0.179922 |              0.100394 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.769518 |   1.0 |     1.2 |      0.2 | 1.488866 |
    | 15.01. |    1.0 |             1.525216 |               1.288866 |     0.111134 |     -0.088866 |              0.264366 |        0.264366 |        0.264366 |      0.264366 |            0.0 | 0.264366 |    0.833076 |   1.0 |     1.3 | 0.264366 | 1.525216 |
    | 16.01. |    1.0 |             1.637612 |               1.260849 |     0.139151 |     -0.125216 |              0.259326 |        0.259326 |        0.259326 |      0.259326 |            0.0 | 0.259326 |    0.897071 |   1.0 |     1.4 | 0.259326 | 1.637612 |
    | 17.01. |    1.0 |              1.74304 |               1.378286 |     0.021714 |     -0.237612 |              0.072326 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.966191 |   1.0 |     1.5 |      0.2 |  1.74304 |
    | 18.01. |    1.0 |             1.824234 |                1.54304 |          0.0 |      -0.34304 |              0.020494 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    1.035311 |   1.0 |     1.6 |      0.2 | 1.824234 |
    | 19.01. |    1.0 |             1.905933 |               1.624234 |          0.0 |     -0.424234 |              0.009932 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    1.104431 |   1.0 |     1.7 |      0.2 | 1.905933 |
    | 20.01. |    1.0 |                  2.0 |               1.705933 |          0.0 |     -0.505933 |              0.004737 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    1.173551 |   1.0 |     1.8 |      0.2 |      2.0 |

    .. raw:: html

        <iframe
            src="dam_v001_ex6.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    >>> solver.abserrormax(1e-2)

    .. _dam_v001_ex07:

    **Example 7**

    To allow for a smooth transition of the water release in periods where
    the highest demand switches from `remote` to `near` or the other way
    round, one can increase the value of the `neardischargeminimumtolerance`
    parameter:

    >>> neardischargeminimumtolerance(0.2)

    It is easiest to inspect the functioning the effect of this "smooth
    switch" by looking at the results of column `requiredrelease`:

    >>> test('dam_v001_ex7')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.840351 |                    1.9 |          0.0 |          -0.5 |                 0.005 |        0.210526 |        0.210526 |      0.201754 |            0.0 | 0.201754 |    0.068968 |   1.0 |     1.8 | 0.201754 | 1.840351 |
    | 02.01. |    1.0 |             1.822886 |               1.638597 |          0.0 |     -0.440351 |              0.008588 |         0.21092 |         0.21092 |       0.21092 |            0.0 |  0.21092 |    0.137145 |   1.0 |     1.7 |  0.21092 | 1.822886 |
    | 03.01. |    1.0 |             1.787111 |               1.611966 |          0.0 |     -0.422886 |              0.010053 |        0.211084 |        0.211084 |      0.211084 |            0.0 | 0.211084 |    0.205307 |   1.0 |     1.6 | 0.211084 | 1.787111 |
    | 04.01. |    1.0 |              1.71019 |               1.576027 |          0.0 |     -0.387111 |              0.013858 |        0.211523 |        0.211523 |      0.211523 |            0.0 | 0.211523 |    0.273432 |   1.0 |     1.5 | 0.211523 |  1.71019 |
    | 05.01. |    1.0 |             1.611668 |               1.498667 |          0.0 |      -0.31019 |              0.027322 |        0.213209 |        0.213209 |      0.213209 |            0.0 | 0.213209 |     0.34141 |   1.0 |     1.4 | 0.213209 | 1.611668 |
    | 06.01. |    1.0 |             1.513658 |               1.398459 |     0.001541 |     -0.211668 |              0.064075 |        0.219043 |        0.219043 |      0.219043 |            0.0 | 0.219043 |    0.408885 |   1.0 |     1.3 | 0.219043 | 1.513658 |
    | 07.01. |    1.0 |             1.429416 |               1.294615 |     0.105385 |     -0.113658 |              0.235523 |        0.283419 |        0.283419 |      0.283419 |            0.0 | 0.283419 |    0.470798 |   1.0 |     1.2 | 0.283419 | 1.429416 |
    | 08.01. |    1.0 |             1.395444 |               1.145997 |     0.254003 |     -0.029416 |              0.470414 |        0.475212 |        0.475212 |      0.475212 |            0.0 | 0.475212 |    0.516139 |   1.0 |     1.1 | 0.475212 | 1.395444 |
    | 09.01. |    1.0 |             1.444071 |               0.920232 |     0.479768 |      0.004556 |              0.735001 |        0.735281 |        0.735281 |      0.735281 |            0.0 | 0.735281 |    0.539011 |   1.0 |     1.0 | 0.735281 | 1.444071 |
    | 10.01. |    1.0 |             1.643281 |                0.70879 |      0.69121 |     -0.044071 |              0.891263 |        0.891315 |        0.891315 |      0.891315 |            0.0 | 0.891315 |    0.548402 |   1.0 |     1.0 | 0.891315 | 1.643281 |
    | 11.01. |    1.0 |             1.763981 |               0.751966 |     0.648034 |     -0.243281 |              0.696325 |        0.696749 |        0.696749 |      0.696749 |            0.0 | 0.696749 |    0.574602 |   1.0 |     1.0 | 0.696749 | 1.763981 |
    | 12.01. |    1.0 |             1.692903 |               1.067232 |     0.332768 |     -0.363981 |              0.349797 |        0.366406 |        0.366406 |      0.366406 |            0.0 | 0.366406 |    0.629345 |   1.0 |     1.0 | 0.366406 | 1.692903 |
    | 13.01. |    1.0 |             1.590367 |               1.326497 |     0.073503 |     -0.292903 |              0.105231 |        0.228241 |        0.228241 |      0.228241 |            0.0 | 0.228241 |    0.696025 |   1.0 |     1.1 | 0.228241 | 1.590367 |
    | 14.01. |    1.0 |             1.516904 |               1.362126 |     0.037874 |     -0.190367 |              0.111928 |        0.230054 |        0.230054 |      0.230054 |            0.0 | 0.230054 |    0.762548 |   1.0 |     1.2 | 0.230054 | 1.516904 |
    | 15.01. |    1.0 |             1.554409 |                1.28685 |      0.11315 |     -0.116904 |              0.240436 |        0.286374 |        0.286374 |      0.286374 |            0.0 | 0.286374 |    0.824205 |   1.0 |     1.3 | 0.286374 | 1.554409 |
    | 16.01. |    1.0 |             1.662351 |               1.268035 |     0.131965 |     -0.154409 |              0.229369 |        0.279807 |        0.279807 |      0.279807 |            0.0 | 0.279807 |     0.88643 |   1.0 |     1.4 | 0.279807 | 1.662351 |
    | 17.01. |    1.0 |             1.764451 |               1.382544 |     0.017456 |     -0.262351 |              0.058622 |         0.21805 |         0.21805 |       0.21805 |            0.0 |  0.21805 |    0.953991 |   1.0 |     1.5 |  0.21805 | 1.764451 |
    | 18.01. |    1.0 |             1.842178 |                 1.5464 |          0.0 |     -0.364451 |              0.016958 |        0.211892 |        0.211892 |      0.211892 |            0.0 | 0.211892 |    1.022083 |   1.0 |     1.6 | 0.211892 | 1.842178 |
    | 19.01. |    1.0 |             1.920334 |               1.630286 |          0.0 |     -0.442178 |              0.008447 |        0.210904 |        0.210904 |      0.210904 |            0.0 | 0.210904 |    1.090261 |   1.0 |     1.7 | 0.210904 | 1.920334 |
    | 20.01. |    1.0 |             2.011822 |               1.709429 |          0.0 |     -0.520334 |              0.004155 |        0.210435 |        0.210435 |      0.210435 |            0.0 | 0.210435 |    1.158479 |   1.0 |     1.8 | 0.210435 | 2.011822 |

    .. raw:: html

        <iframe
            src="dam_v001_ex7.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex08_1:

    **Example 8.1**

    |dam_v001| is forced to keep a certain degree of low flow variability
    when the option flag |RestrictTargetedRelease| is enabled.  Then it is
    not allowed to release an arbitrary amount of water when the inflow
    falls below the required minimum water release.  We show this by
    decreasing the inflow in the second half of the simulation period
    to 0.1 m³/s:

    >>> input_.sequences.sim.series[10:] = 0.1

    The value of parameter |NearDischargeMinimumThreshold| (0.2 m³/s) is
    maintained, but the value of |NearDischargeMinimumTolerance| is reset
    to 0 m³/s for improving comprehensibility:

    >>> neardischargeminimumtolerance(0.0)

    As to be expected, the actual release drops to 0.1 m³/s on January 11.
    But, due to the time delay of the discharge released earlier, the
    largest violation of the threshold value takes place on January, 13:

    >>> test('dam_v001_ex8_1')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.838333 |                    1.9 |          0.0 |          -0.5 |                 0.005 |             0.2 |             0.2 |      0.191667 |            0.0 | 0.191667 |     0.06984 |   1.0 |     1.8 | 0.191667 | 1.838333 |
    | 02.01. |    1.0 |             1.816667 |               1.646667 |          0.0 |     -0.438333 |              0.008746 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.13896 |   1.0 |     1.7 |      0.2 | 1.816667 |
    | 03.01. |    1.0 |               1.7775 |               1.616667 |          0.0 |     -0.416667 |              0.010632 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.20808 |   1.0 |     1.6 |      0.2 |   1.7775 |
    | 04.01. |    1.0 |             1.699167 |                 1.5775 |          0.0 |       -0.3775 |              0.015099 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |      0.2772 |   1.0 |     1.5 |      0.2 | 1.699167 |
    | 05.01. |    1.0 |                  1.6 |               1.499167 |          0.0 |     -0.299167 |               0.03006 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.34632 |   1.0 |     1.4 |      0.2 |      1.6 |
    | 06.01. |    1.0 |                  1.5 |                    1.4 |          0.0 |          -0.2 |              0.068641 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.41544 |   1.0 |     1.3 |      0.2 |      1.5 |
    | 07.01. |    1.0 |             1.408516 |                    1.3 |          0.1 |          -0.1 |              0.242578 |        0.242578 |        0.242578 |      0.242578 |            0.0 | 0.242578 |    0.480881 |   1.0 |     1.2 | 0.242578 | 1.408516 |
    | 08.01. |    1.0 |             1.371888 |               1.165937 |     0.234063 |     -0.008516 |              0.474285 |        0.474285 |        0.474285 |      0.474285 |            0.0 | 0.474285 |    0.526303 |   1.0 |     1.1 | 0.474285 | 1.371888 |
    | 09.01. |    1.0 |              1.43939 |               0.897603 |     0.502397 |      0.028112 |              0.784512 |        0.784512 |        0.784512 |      0.784512 |            0.0 | 0.784512 |    0.544921 |   1.0 |     1.0 | 0.784512 |  1.43939 |
    | 10.01. |    1.0 |              1.67042 |               0.654878 |     0.745122 |      -0.03939 |               0.95036 |         0.95036 |         0.95036 |       0.95036 |            0.0 |  0.95036 |     0.54921 |   1.0 |     1.0 |  0.95036 |  1.67042 |
    | 11.01. |    0.1 |             1.682926 |               0.720061 |     0.679939 |      -0.27042 |               0.71839 |         0.71839 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.0 |      0.1 | 1.682926 |
    | 12.01. |    0.1 |             1.423559 |               1.582926 |          0.0 |     -0.282926 |              0.034564 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.0 |      0.1 | 1.423559 |
    | 13.01. |    0.1 |             1.285036 |               1.323559 |     0.076441 |     -0.023559 |              0.299482 |        0.299482 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.1 |      0.1 | 1.285036 |
    | 14.01. |    0.1 |                  1.3 |               1.185036 |     0.214964 |      0.114964 |              0.585979 |        0.585979 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.2 |      0.1 |      1.3 |
    | 15.01. |    0.1 |                  1.4 |                    1.2 |          0.2 |           0.1 |              0.557422 |        0.557422 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.3 |      0.1 |      1.4 |
    | 16.01. |    0.1 |                  1.5 |                    1.3 |          0.1 |          -0.0 |                  0.35 |            0.35 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.4 |      0.1 |      1.5 |
    | 17.01. |    0.1 |                  1.6 |                    1.4 |          0.0 |          -0.1 |              0.142578 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.5 |      0.1 |      1.6 |
    | 18.01. |    0.1 |                  1.7 |                    1.5 |          0.0 |          -0.2 |              0.068641 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.6 |      0.1 |      1.7 |
    | 19.01. |    0.1 |                  1.8 |                    1.6 |          0.0 |          -0.3 |              0.029844 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.7 |      0.1 |      1.8 |
    | 20.01. |    0.1 |                  1.9 |                    1.7 |          0.0 |          -0.4 |              0.012348 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |     1.8 |      0.1 |      1.9 |

    .. raw:: html

        <iframe
            src="dam_v001_ex8_1.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex08_2:

    **Example 8.2**

    This modification of the last example shows that with an disabled
    |RestrictTargetedRelease| flag the amount of water released is
    allowed to exceed the the inflow in any case:

    >>> restricttargetedrelease(False)
    >>> test('dam_v001_ex8_2')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.838333 |                    1.9 |          0.0 |          -0.5 |                 0.005 |             0.2 |             0.2 |      0.191667 |            0.0 | 0.191667 |     0.06984 |   1.0 |     1.8 | 0.191667 | 1.838333 |
    | 02.01. |    1.0 |             1.816667 |               1.646667 |          0.0 |     -0.438333 |              0.008746 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.13896 |   1.0 |     1.7 |      0.2 | 1.816667 |
    | 03.01. |    1.0 |               1.7775 |               1.616667 |          0.0 |     -0.416667 |              0.010632 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.20808 |   1.0 |     1.6 |      0.2 |   1.7775 |
    | 04.01. |    1.0 |             1.699167 |                 1.5775 |          0.0 |       -0.3775 |              0.015099 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |      0.2772 |   1.0 |     1.5 |      0.2 | 1.699167 |
    | 05.01. |    1.0 |                  1.6 |               1.499167 |          0.0 |     -0.299167 |               0.03006 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.34632 |   1.0 |     1.4 |      0.2 |      1.6 |
    | 06.01. |    1.0 |                  1.5 |                    1.4 |          0.0 |          -0.2 |              0.068641 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.41544 |   1.0 |     1.3 |      0.2 |      1.5 |
    | 07.01. |    1.0 |             1.408516 |                    1.3 |          0.1 |          -0.1 |              0.242578 |        0.242578 |        0.242578 |      0.242578 |            0.0 | 0.242578 |    0.480881 |   1.0 |     1.2 | 0.242578 | 1.408516 |
    | 08.01. |    1.0 |             1.371888 |               1.165937 |     0.234063 |     -0.008516 |              0.474285 |        0.474285 |        0.474285 |      0.474285 |            0.0 | 0.474285 |    0.526303 |   1.0 |     1.1 | 0.474285 | 1.371888 |
    | 09.01. |    1.0 |              1.43939 |               0.897603 |     0.502397 |      0.028112 |              0.784512 |        0.784512 |        0.784512 |      0.784512 |            0.0 | 0.784512 |    0.544921 |   1.0 |     1.0 | 0.784512 |  1.43939 |
    | 10.01. |    1.0 |              1.67042 |               0.654878 |     0.745122 |      -0.03939 |               0.95036 |         0.95036 |         0.95036 |       0.95036 |            0.0 |  0.95036 |     0.54921 |   1.0 |     1.0 |  0.95036 |  1.67042 |
    | 11.01. |    0.1 |             1.806604 |               0.720061 |     0.679939 |      -0.27042 |               0.71839 |         0.71839 |         0.71839 |       0.71839 |            0.0 |  0.71839 |    0.495781 |   0.1 |     1.0 |  0.71839 | 1.806604 |
    | 12.01. |    0.1 |               1.7156 |               1.088214 |     0.311786 |     -0.406604 |              0.323424 |        0.323424 |        0.323424 |      0.323424 |            0.0 | 0.323424 |    0.476477 |   0.1 |     1.0 | 0.323424 |   1.7156 |
    | 13.01. |    0.1 |             1.579922 |               1.392176 |     0.007824 |       -0.3156 |               0.03389 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.467837 |   0.1 |     1.1 |      0.2 | 1.579922 |
    | 14.01. |    0.1 |             1.488866 |               1.379922 |     0.020078 |     -0.179922 |              0.100394 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |    0.459197 |   0.1 |     1.2 |      0.2 | 1.488866 |
    | 15.01. |    0.1 |             1.525216 |               1.288866 |     0.111134 |     -0.088866 |              0.264366 |        0.264366 |        0.264366 |      0.264366 |            0.0 | 0.264366 |    0.444996 |   0.1 |     1.3 | 0.264366 | 1.525216 |
    | 16.01. |    0.1 |             1.637612 |               1.260849 |     0.139151 |     -0.125216 |              0.259326 |        0.259326 |        0.259326 |      0.259326 |            0.0 | 0.259326 |     0.43123 |   0.1 |     1.4 | 0.259326 | 1.637612 |
    | 17.01. |    0.1 |              1.74304 |               1.378286 |     0.021714 |     -0.237612 |              0.072326 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.42259 |   0.1 |     1.5 |      0.2 |  1.74304 |
    | 18.01. |    0.1 |             1.824234 |                1.54304 |          0.0 |      -0.34304 |              0.020494 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.41395 |   0.1 |     1.6 |      0.2 | 1.824234 |
    | 19.01. |    0.1 |             1.905933 |               1.624234 |          0.0 |     -0.424234 |              0.009932 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.40531 |   0.1 |     1.7 |      0.2 | 1.905933 |
    | 20.01. |    0.1 |                  2.0 |               1.705933 |          0.0 |     -0.505933 |              0.004737 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.39667 |   0.1 |     1.8 |      0.2 |      2.0 |

    .. raw:: html

        <iframe
            src="dam_v001_ex8_2.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    >>> restricttargetedrelease(True)

    .. _dam_v001_ex09:

    **Example 9**

    Another issue of the dam model relevant for the simulation of drought
    events to be discussed is the possible restriction of water release
    due to limited storage.  To focus on this, we reset the parameter
    |NearDischargeMinimumThreshold| to 0 m³/s and define smaller inflow
    values, which are constantly decreasing from 0.2 m³/s to 0.0 m³/s:

    >>> neardischargeminimumthreshold(0.0)
    >>> input_.sequences.sim.series = numpy.linspace(0.2, 0.0, 20)

    Now the storage content increases only until January, 5.  Afterwards
    the dam begins to run dry.  On January 11, the dam is actually empty.
    But there are some fluctuations of the water volume around 0 m³.
    The most severe deviation from the correct value of 0 m³ occurs on
    January 12, where the final storage volume is -666 m³:

    >>> test('dam_v001_ex9')
    |   date |   inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume |    input | natural |   output |   remote |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |      0.2 |              1.80075 |                    1.9 |          0.0 |          -0.5 |                 0.005 |           0.005 |           0.005 |       0.00375 |            0.0 |  0.00375 |    0.016956 |      0.2 |     1.8 |  0.00375 |  1.80075 |
    | 02.01. | 0.189474 |             1.703953 |                  1.797 |          0.0 |      -0.40075 |              0.012265 |        0.012265 |        0.012265 |      0.012265 |            0.0 | 0.012265 |    0.032267 | 0.189474 |     1.7 | 0.012265 | 1.703953 |
    | 03.01. | 0.178947 |             1.611799 |               1.691688 |          0.0 |     -0.303953 |              0.028841 |        0.028841 |        0.028841 |      0.028841 |            0.0 | 0.028841 |    0.045236 | 0.178947 |     1.6 | 0.028841 | 1.611799 |
    | 04.01. | 0.168421 |             1.528085 |               1.582958 |          0.0 |     -0.211799 |              0.062468 |        0.062468 |        0.062468 |      0.062468 |            0.0 | 0.062468 |     0.05439 | 0.168421 |     1.5 | 0.062468 | 1.528085 |
    | 05.01. | 0.157895 |             1.458423 |               1.465616 |          0.0 |     -0.128085 |              0.117784 |        0.117784 |        0.117784 |      0.117784 |            0.0 | 0.117784 |    0.057856 | 0.157895 |     1.4 | 0.117784 | 1.458423 |
    | 06.01. | 0.147368 |             1.417501 |               1.340639 |     0.059361 |     -0.058423 |              0.243813 |        0.243813 |        0.243813 |      0.243813 |            0.0 | 0.243813 |    0.049523 | 0.147368 |     1.3 | 0.243813 | 1.417501 |
    | 07.01. | 0.136842 |             1.430358 |               1.173688 |     0.226312 |     -0.017501 |              0.456251 |        0.456251 |        0.456251 |      0.456251 |            0.0 | 0.456251 |    0.021926 | 0.136842 |     1.2 | 0.456251 | 1.430358 |
    | 08.01. | 0.126316 |             1.443995 |               0.974107 |     0.425893 |     -0.030358 |              0.641243 |        0.641243 |        0.641243 |      0.382861 |            0.0 | 0.382861 |   -0.000239 | 0.126316 |     1.1 | 0.382861 | 1.443995 |
    | 09.01. | 0.115789 |             1.337495 |               1.061134 |     0.338866 |     -0.043995 |              0.539003 |        0.539003 |        0.539003 |       0.11547 |            0.0 |  0.11547 |   -0.000212 | 0.115789 |     1.0 |  0.11547 | 1.337495 |
    | 10.01. | 0.105263 |             1.228344 |               1.222025 |     0.177975 |      0.062505 |              0.497868 |        0.497868 |        0.497868 |      0.108362 |            0.0 | 0.108362 |    -0.00048 | 0.105263 |     1.0 | 0.108362 | 1.228344 |
    | 11.01. | 0.094737 |             1.134148 |               1.119981 |     0.280019 |      0.171656 |              0.694448 |        0.694448 |        0.694448 |      0.089381 |            0.0 | 0.089381 |   -0.000017 | 0.094737 |     1.0 | 0.089381 | 1.134148 |
    | 12.01. | 0.084211 |             1.098152 |               1.044768 |     0.355232 |      0.265852 |              0.815265 |        0.815265 |        0.815265 |      0.091721 |            0.0 | 0.091721 |   -0.000666 | 0.084211 |     1.0 | 0.091721 | 1.098152 |
    | 13.01. | 0.073684 |              1.18792 |               1.006431 |     0.393569 |      0.301848 |              0.864198 |        0.864198 |        0.864198 |      0.067904 |            0.0 | 0.067904 |   -0.000166 | 0.073684 |     1.1 | 0.067904 |  1.18792 |
    | 14.01. | 0.063158 |             1.277116 |               1.120015 |     0.279985 |       0.21208 |              0.717657 |        0.717657 |        0.717657 |      0.067501 |            0.0 | 0.067501 |   -0.000542 | 0.063158 |     1.2 | 0.067501 | 1.277116 |
    | 15.01. | 0.052632 |             1.365852 |               1.209616 |     0.190384 |      0.122884 |              0.568242 |        0.568242 |        0.568242 |      0.046544 |            0.0 | 0.046544 |   -0.000016 | 0.052632 |     1.3 | 0.046544 | 1.365852 |
    | 16.01. | 0.042105 |             1.455275 |               1.319309 |     0.080691 |      0.034148 |              0.369601 |        0.369601 |        0.369601 |      0.048083 |            0.0 | 0.048083 |   -0.000532 | 0.042105 |     1.4 | 0.048083 | 1.455275 |
    | 17.01. | 0.031579 |              1.54538 |               1.407192 |          0.0 |     -0.055275 |              0.187833 |        0.187833 |        0.187833 |      0.027168 |            0.0 | 0.027168 |   -0.000151 | 0.031579 |     1.5 | 0.027168 |  1.54538 |
    | 18.01. | 0.021053 |             1.634293 |               1.518212 |          0.0 |      -0.14538 |              0.104078 |        0.104078 |        0.104078 |      0.021731 |            0.0 | 0.021731 |    -0.00021 | 0.021053 |     1.6 | 0.021731 | 1.634293 |
    | 19.01. | 0.010526 |             1.724252 |               1.612561 |          0.0 |     -0.234293 |              0.052016 |        0.052016 |        0.052016 |      0.013004 |            0.0 | 0.013004 |   -0.000424 | 0.010526 |     1.7 | 0.013004 | 1.724252 |
    | 20.01. |      0.0 |             1.814438 |               1.711248 |          0.0 |     -0.324252 |               0.02417 |         0.02417 |        0.012085 |           0.0 |            0.0 |      0.0 |   -0.000424 |      0.0 |     1.8 |      0.0 | 1.814438 |

    .. raw:: html

        <iframe
            src="dam_v001_ex9.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    This behaviour of the dam model is due to method |calc_actualrelease_v1|
    being involved in the set of differential equation that are solved
    approximately by a numerical integration algorithm.  Theoretically,
    we could decrease the local truncation error to decrease this
    problem significantly.  But this could result in quite huge
    computation times, as the underlying numerical algorithm is not
    really able to handle the discontinuous relationship between release
    and volume around |NearDischargeMinimumThreshold|.

    .. _dam_v001_ex10:

    **Example 10**

    One solution would be to define another version of the dam model and
    simply implement an alternative balance equation for the calculation of
    the actual release (not done yet, but seems to be worth the effort).
    When using the version of the dam model discussed here, it is instead
    advised to smooth this problematic discontinuity by increasing the
    value of parameter |NearDischargeMinimumTolerance| (which could not be
    implemented properly if method |calc_actualrelease_v1| would
    apply a simple balance equation):

    >>> waterlevelminimumtolerance(0.01)

    If one wants to avoid not only the fluctuation but also the negative
    values of the water volume, one should also sligthly increase the
    original threshold value, e.g.:

    >>> waterlevelminimumthreshold(0.005)

    Now water storage is decaying smoothly.  The lowest storage content
    of 541 m³ occurs on January 14.  After that date, the dam is refilled
    to a certain degree.  This is due the decreasing remote demand. Note
    that negative storage values are circumvented in this example, but this
    would have not been the case if the low flow period were prolonged:

    >>> test('dam_v001_ex10')
    |   date |   inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume |    input | natural |   output |   remote |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |      0.2 |             1.800256 |                    1.9 |          0.0 |          -0.5 |                 0.005 |           0.005 |           0.005 |      0.001282 |            0.0 | 0.001282 |    0.017169 |      0.2 |     1.8 | 0.001282 | 1.800256 |
    | 02.01. | 0.189474 |             1.702037 |               1.798975 |          0.0 |     -0.400256 |               0.01232 |         0.01232 |         0.01232 |      0.007624 |            0.0 | 0.007624 |    0.032881 | 0.189474 |     1.7 | 0.007624 | 1.702037 |
    | 03.01. | 0.178947 |             1.608618 |               1.694414 |          0.0 |     -0.302037 |              0.029323 |        0.029323 |        0.029323 |      0.025921 |            0.0 | 0.025921 |    0.046103 | 0.178947 |     1.6 | 0.025921 | 1.608618 |
    | 04.01. | 0.168421 |             1.525188 |               1.582697 |          0.0 |     -0.208618 |              0.064084 |        0.064084 |        0.064084 |      0.062022 |            0.0 | 0.062022 |    0.055296 | 0.168421 |     1.5 | 0.062022 | 1.525188 |
    | 05.01. | 0.157895 |             1.457043 |               1.463166 |          0.0 |     -0.125188 |              0.120198 |        0.120198 |        0.120198 |      0.118479 |            0.0 | 0.118479 |    0.058701 | 0.157895 |     1.4 | 0.118479 | 1.457043 |
    | 06.01. | 0.147368 |             1.417039 |               1.338564 |     0.061436 |     -0.057043 |              0.247367 |        0.247367 |        0.247367 |      0.242243 |            0.0 | 0.242243 |    0.050504 | 0.147368 |     1.3 | 0.242243 | 1.417039 |
    | 07.01. | 0.136842 |             1.418109 |               1.174796 |     0.225204 |     -0.017039 |               0.45567 |         0.45567 |         0.45567 |      0.397328 |            0.0 | 0.397328 |    0.027998 | 0.136842 |     1.2 | 0.397328 | 1.418109 |
    | 08.01. | 0.126316 |             1.401604 |               1.020781 |     0.379219 |     -0.018109 |              0.608464 |        0.608464 |        0.608464 |      0.290761 |            0.0 | 0.290761 |     0.01379 | 0.126316 |     1.1 | 0.290761 | 1.401604 |
    | 09.01. | 0.115789 |             1.290584 |               1.110843 |     0.289157 |     -0.001604 |              0.537314 |        0.537314 |        0.537314 |      0.154283 |            0.0 | 0.154283 |    0.010464 | 0.115789 |     1.0 | 0.154283 | 1.290584 |
    | 10.01. | 0.105263 |             1.216378 |               1.136301 |     0.263699 |      0.109416 |              0.629775 |        0.629775 |        0.629775 |      0.138519 |            0.0 | 0.138519 |    0.007591 | 0.105263 |     1.0 | 0.138519 | 1.216378 |
    | 11.01. | 0.094737 |              1.15601 |               1.077859 |     0.322141 |      0.183622 |              0.744091 |        0.744091 |        0.744091 |      0.126207 |            0.0 | 0.126207 |    0.004871 | 0.094737 |     1.0 | 0.126207 |  1.15601 |
    | 12.01. | 0.084211 |             1.129412 |               1.029803 |     0.370197 |       0.24399 |               0.82219 |         0.82219 |         0.82219 |      0.109723 |            0.0 | 0.109723 |    0.002667 | 0.084211 |     1.0 | 0.109723 | 1.129412 |
    | 13.01. | 0.073684 |             1.214132 |               1.019689 |     0.380311 |      0.270588 |              0.841916 |        0.841916 |        0.841916 |      0.092645 |            0.0 | 0.092645 |    0.001029 | 0.073684 |     1.1 | 0.092645 | 1.214132 |
    | 14.01. | 0.063158 |             1.296357 |               1.121487 |     0.278513 |      0.185868 |              0.701812 |        0.701812 |        0.701812 |      0.068806 |            0.0 | 0.068806 |    0.000541 | 0.063158 |     1.2 | 0.068806 | 1.296357 |
    | 15.01. | 0.052632 |             1.376644 |               1.227551 |     0.172449 |      0.103643 |              0.533258 |        0.533258 |        0.533258 |      0.051779 |            0.0 | 0.051779 |    0.000615 | 0.052632 |     1.3 | 0.051779 | 1.376644 |
    | 16.01. | 0.042105 |             1.457718 |               1.324865 |     0.075135 |      0.023356 |              0.351863 |        0.351863 |        0.351863 |      0.035499 |            0.0 | 0.035499 |    0.001185 | 0.042105 |     1.4 | 0.035499 | 1.457718 |
    | 17.01. | 0.031579 |             1.540662 |               1.422218 |          0.0 |     -0.057718 |              0.185207 |        0.185207 |        0.185207 |       0.02024 |            0.0 |  0.02024 |    0.002165 | 0.031579 |     1.5 |  0.02024 | 1.540662 |
    | 18.01. | 0.021053 |             1.626481 |               1.520422 |          0.0 |     -0.140662 |              0.107697 |        0.107697 |        0.107697 |      0.012785 |            0.0 | 0.012785 |    0.002879 | 0.021053 |     1.6 | 0.012785 | 1.626481 |
    | 19.01. | 0.010526 |              1.71612 |               1.613695 |          0.0 |     -0.226481 |              0.055458 |        0.055458 |        0.055458 |      0.006918 |            0.0 | 0.006918 |    0.003191 | 0.010526 |     1.7 | 0.006918 |  1.71612 |
    | 20.01. |      0.0 |             1.808953 |               1.709201 |          0.0 |      -0.31612 |              0.025948 |        0.025948 |        0.012974 |      0.001631 |            0.0 | 0.001631 |     0.00305 |      0.0 |     1.8 | 0.001631 | 1.808953 |

    .. raw:: html

        <iframe
            src="dam_v001_ex10.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    So the fluctuation seems to be gone, but there is still some
    inaccuracy in the results.  Note that the last outflow value is smaller
    than the local truncation error.  However, due to the smoothing of
    the discontinuous relationship it would now be possible to define
    a lower local truncation error without to increase computation times
    too much.

    .. _dam_v001_ex11:

    **Example 11**

    The last "drought parameter" we did no not vary so far is
    |NmbLogEntries|.  In the examples above, this parameter was always
    set to 1, meaning that each estimate of the `natural` discharge of
    the subcatchment was based only on the latest observation.  Using
    only the latest observation offers the advantage of quick adjustments
    of the control of the dam.  But there is a risk of the estimates being
    too uncertain and of a bad timing of water releases during periods of
    fast fluctations.

    Let us define a series of extreme fluctuations by repeating the the
    natural discharge values of 1.5 m³/s and 0.5 m³/s ten times:

    >>> natural.sequences.sim.series = 10*[1.5, 0.5]

    Also increase the inflow to 1 m³/s again, to assure that the dam is
    actually able to release as much water as has been estimated to be
    required:

    >>> input_.sequences.sim.series = 1.0

    Furthermore, assume that there is no relevant routing time between
    the outlet of the dam and the cross section downstream:

    >>> stream1.model.parameters.control.responses(((), (1.0,)))
    >>> stream1.model.parameters.update()

    The example is a little artificial, but reveals a general problem
    that might occur in different forms.  Due to the time delay of the
    information flow from the cross section to the dam, much water is
    wasted to increase the peak flows, but the violations of the low flow
    threshold remain almost unchanged:

    >>> test('dam_v001_ex11')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.502727 |                    1.9 |          0.0 |          -0.5 |                 0.005 |           0.005 |           0.005 |      0.002727 |            0.0 | 0.002727 |    0.086164 |   1.0 |     1.5 | 0.002727 | 1.502727 |
    | 02.01. |    1.0 |             0.640003 |                    1.5 |          0.0 |     -0.102727 |              0.140038 |        0.140038 |        0.140038 |      0.140003 |            0.0 | 0.140003 |    0.160468 |   1.0 |     0.5 | 0.140003 | 0.640003 |
    | 03.01. |    1.0 |             2.899534 |                    0.5 |          0.9 |      0.759997 |              1.399537 |        1.399537 |        1.399537 |      1.399534 |            0.0 | 1.399534 |    0.125948 |   1.0 |     1.5 | 1.399534 | 2.899534 |
    | 04.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499534 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.212348 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 05.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.177799 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 06.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.264199 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 07.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |     0.22965 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 08.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |     0.31605 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 09.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.281501 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 10.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.367901 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 11.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.333352 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 12.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.419752 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 13.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.385203 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 14.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.471603 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 15.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.437054 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 16.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.523454 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 17.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.488905 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 18.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.575305 |   1.0 |     0.5 | 0.000001 | 0.500001 |
    | 19.01. |    1.0 |             2.899872 |                    0.5 |          0.9 |      0.899999 |              1.399872 |        1.399872 |        1.399872 |      1.399872 |            0.0 | 1.399872 |    0.540756 |   1.0 |     1.5 | 1.399872 | 2.899872 |
    | 20.01. |    1.0 |             0.500001 |                    1.5 |          0.0 |     -1.499872 |              0.000001 |        0.000001 |        0.000001 |      0.000001 |            0.0 | 0.000001 |    0.627156 |   1.0 |     0.5 | 0.000001 | 0.500001 |

    .. raw:: html

        <iframe
            src="dam_v001_ex11.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    .. _dam_v001_ex12:

    **Example 12**

    It seems advisable to increase the number of observations taken into
    account to estimate the natural discharge at the cross section.
    For this purpose, the value of parameter |NmbLogEntries| is set to
    two days:

    >>> nmblogentries(2)

    Now the water release is relatively constant.  This does not completely
    solve the problems of wasting water during peak flows and the repeated
    violation the low flow threshold, but reduces them significantly:

    >>> test('dam_v001_ex12')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.502727 |                    1.9 |          0.0 |          -0.5 |                 0.005 |           0.005 |           0.005 |      0.002727 |            0.0 | 0.002727 |    0.086164 |   1.0 |     1.5 | 0.002727 | 1.502727 |
    | 02.01. |    1.0 |             0.529487 |                    1.7 |          0.0 |     -0.301364 |              0.029495 |        0.029495 |        0.029495 |      0.029487 |            0.0 | 0.029487 |    0.170017 |   1.0 |     0.5 | 0.029487 | 0.529487 |
    | 03.01. |    1.0 |             2.385738 |                    1.0 |          0.4 |      0.383893 |              0.885738 |        0.885738 |        0.885738 |      0.885738 |            0.0 | 0.885738 |    0.179889 |   1.0 |     1.5 | 0.885738 | 2.385738 |
    | 04.01. |    1.0 |              1.08532 |                    1.0 |          0.4 |     -0.057613 |               0.58532 |         0.58532 |         0.58532 |       0.58532 |            0.0 |  0.58532 |    0.215717 |   1.0 |     0.5 |  0.58532 |  1.08532 |
    | 05.01. |    1.0 |             1.921895 |                    1.0 |          0.4 |     -0.335529 |              0.421895 |        0.421895 |        0.421895 |      0.421895 |            0.0 | 0.421895 |    0.265666 |   1.0 |     1.5 | 0.421895 | 1.921895 |
    | 06.01. |    1.0 |             1.039224 |                    1.0 |          0.4 |     -0.103607 |              0.539224 |        0.539224 |        0.539224 |      0.539224 |            0.0 | 0.539224 |    0.305477 |   1.0 |     0.5 | 0.539224 | 1.039224 |
    | 07.01. |    1.0 |             2.061463 |                    1.0 |          0.4 |     -0.080559 |              0.561463 |        0.561463 |        0.561463 |      0.561463 |            0.0 | 0.561463 |    0.343366 |   1.0 |     1.5 | 0.561463 | 2.061463 |
    | 08.01. |    1.0 |             1.000369 |                    1.0 |          0.4 |     -0.150343 |              0.500369 |        0.500369 |        0.500369 |      0.500369 |            0.0 | 0.500369 |    0.386534 |   1.0 |     0.5 | 0.500369 | 1.000369 |
    | 09.01. |    1.0 |             2.015458 |                    1.0 |          0.4 |     -0.130916 |              0.515458 |        0.515458 |        0.515458 |      0.515458 |            0.0 | 0.515458 |    0.428399 |   1.0 |     1.5 | 0.515458 | 2.015458 |
    | 10.01. |    1.0 |             1.035283 |                    1.0 |          0.4 |     -0.107913 |              0.535283 |        0.535283 |        0.535283 |      0.535283 |            0.0 | 0.535283 |     0.46855 |   1.0 |     0.5 | 0.535283 | 1.035283 |
    | 11.01. |    1.0 |             2.020045 |                    1.0 |          0.4 |     -0.125371 |              0.520045 |        0.520045 |        0.520045 |      0.520045 |            0.0 | 0.520045 |    0.510018 |   1.0 |     1.5 | 0.520045 | 2.020045 |
    | 12.01. |    1.0 |             1.018133 |                    1.0 |          0.4 |     -0.127664 |              0.518133 |        0.518133 |        0.518133 |      0.518133 |            0.0 | 0.518133 |    0.551652 |   1.0 |     0.5 | 0.518133 | 1.018133 |
    | 13.01. |    1.0 |              2.02539 |                    1.0 |          0.4 |     -0.119089 |               0.52539 |         0.52539 |         0.52539 |       0.52539 |            0.0 |  0.52539 |    0.592658 |   1.0 |     1.5 |  0.52539 |  2.02539 |
    | 14.01. |    1.0 |             1.023097 |                    1.0 |          0.4 |     -0.121761 |              0.523097 |        0.523097 |        0.523097 |      0.523097 |            0.0 | 0.523097 |    0.633863 |   1.0 |     0.5 | 0.523097 | 1.023097 |
    | 15.01. |    1.0 |             2.020992 |                    1.0 |          0.4 |     -0.124244 |              0.520992 |        0.520992 |        0.520992 |      0.520992 |            0.0 | 0.520992 |    0.675249 |   1.0 |     1.5 | 0.520992 | 2.020992 |
    | 16.01. |    1.0 |             1.022855 |                    1.0 |          0.4 |     -0.122045 |              0.522855 |        0.522855 |        0.522855 |      0.522855 |            0.0 | 0.522855 |    0.716474 |   1.0 |     0.5 | 0.522855 | 1.022855 |
    | 17.01. |    1.0 |             2.022958 |                    1.0 |          0.4 |     -0.121924 |              0.522958 |        0.522958 |        0.522958 |      0.522958 |            0.0 | 0.522958 |     0.75769 |   1.0 |     1.5 | 0.522958 | 2.022958 |
    | 18.01. |    1.0 |             1.022123 |                    1.0 |          0.4 |     -0.122907 |              0.522123 |        0.522123 |        0.522123 |      0.522123 |            0.0 | 0.522123 |    0.798979 |   1.0 |     0.5 | 0.522123 | 1.022123 |
    | 19.01. |    1.0 |             2.022434 |                    1.0 |          0.4 |      -0.12254 |              0.522434 |        0.522434 |        0.522434 |      0.522434 |            0.0 | 0.522434 |    0.840241 |   1.0 |     1.5 | 0.522434 | 2.022434 |
    | 20.01. |    1.0 |             1.022657 |                    1.0 |          0.4 |     -0.122278 |              0.522657 |        0.522657 |        0.522657 |      0.522657 |            0.0 | 0.522657 |    0.881483 |   1.0 |     0.5 | 0.522657 | 1.022657 |

    .. raw:: html

        <iframe
            src="dam_v001_ex12.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    Such negative effects due to information delay cannot be circumvented
    easily, unless one would solve the differential equations of all models
    involved simultaneously.  However, at least for drougth events (with
    much slower dynamics than flood events) these delays should normally
    be not overly important.

    .. _dam_v001_ex13:

    **Example 13**

    This and the following examples are supposed to demonstrate that the flood
    retention methods are implemented properly.  Hence, all parameters related
    to low water calculations are set in a deactivating manner:

    >>> nmblogentries(1)
    >>> remotedischargeminimum(0.0)
    >>> remotedischargesafety(0.0)
    >>> neardischargeminimumthreshold(0.0)
    >>> neardischargeminimumtolerance(0.0)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)

    To be able to compare the following numerical results of HydPy-Dam with
    an analytical solution, we approximate a linear storage retetenion
    process.  The relationship between water level and volume has already
    been defined to be (approximately) linear in the range of 0 to 1e8 m³
    or 0 to 25 m, respectively.  The relationship between flood discharge
    and the water level is also approximately linear in this range, with a
    discharge value of 62.5 m³/s for a water level 25 m:

    >>> waterlevel2flooddischarge(ann(
    ...         weights_input=1e-6, weights_output=1e7,
    ...         intercepts_hidden=0.0, intercepts_output=-1e7/2))
    >>> waterlevel2flooddischarge.plot(0.0, 25.0)

    .. testsetup::

        >>> pyplot.close()

    Hence, for the given simulation step size, the linear storage
    coefficient is approximately 0.054 per day.

    (Please be careful when defining such extremely large and small parameter
    values for  |WaterVolume2WaterLevel| and |WaterLevel2FloodDischarge|.
    Otherwise you might get into precision loss trouble, causing the
    numerical calculations of the dam model to become very slow or the
    results to be very inaccurate.  So either use `normal` parameter values
    or check the precision of the results of `watervolume2waterlevel` and
    |WaterLevel2FloodDischarge| manually before performing the actual
    simulation runs.)

    Now a flood event needs to be defined:

    >>> input_.sequences.sim.series = [ 0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...                                 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]

    For the sake of simplicity, a constant discharge of 1 m³/s of the
    subcatchment is assumed:

    >>> test.inits.loggedtotalremotedischarge = 1.0
    >>> natural.sequences.sim.series = 1.0

    At first, a low numerical accuracy of 0.01 m³/s is defined, which should
    be sufficient for most flood simulations for large dams:

    >>> solver.abserrormax(1e-2)

    When simulating flood events, numerical stability and accuracy and
    their relation to computation time should be examined more closely.
    We use the number of function calls of the set of differential
    equations as an indicator for computation time, and set the
    corresponding counter to zero:

    >>> model.numvars.nmb_calls = 0

    You can plot this table to see that the dam actually responds
    (approximately) like a linear storage:

    >>> test('dam_v001_ex13')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |         0.0 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 02.01. |    1.0 |             1.026514 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.026514 | 0.026514 |    0.084109 |   1.0 |     1.0 | 0.026514 | 1.026514 |
    | 03.01. |    5.0 |             1.183744 |                    1.0 |          0.0 |     -1.026514 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.183744 | 0.183744 |    0.500234 |   5.0 |     1.0 | 0.183744 | 1.183744 |
    | 04.01. |    9.0 |             1.542983 |                    1.0 |          0.0 |     -1.183744 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.542983 | 0.542983 |     1.23092 |   9.0 |     1.0 | 0.542983 | 1.542983 |
    | 05.01. |    8.0 |             1.961039 |                    1.0 |          0.0 |     -1.542983 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.961039 | 0.961039 |    1.839086 |   8.0 |     1.0 | 0.961039 | 1.961039 |
    | 06.01. |    5.0 |             2.251523 |                    1.0 |          0.0 |     -1.961039 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.251523 | 1.251523 |    2.162955 |   5.0 |     1.0 | 1.251523 | 2.251523 |
    | 07.01. |    3.0 |             2.395546 |                    1.0 |          0.0 |     -2.251523 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.395546 | 1.395546 |    2.301579 |   3.0 |     1.0 | 1.395546 | 2.395546 |
    | 08.01. |    2.0 |             2.453375 |                    1.0 |          0.0 |     -2.395546 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.453375 | 1.453375 |    2.348808 |   2.0 |     1.0 | 1.453375 | 2.453375 |
    | 09.01. |    1.0 |             2.455596 |                    1.0 |          0.0 |     -2.453375 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.455596 | 1.455596 |    2.309444 |   1.0 |     1.0 | 1.455596 | 2.455596 |
    | 10.01. |    0.0 |             2.405132 |                    1.0 |          0.0 |     -2.455596 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.405132 | 1.405132 |    2.188041 |   0.0 |     1.0 | 1.405132 | 2.405132 |
    | 11.01. |    0.0 |             2.331267 |                    1.0 |          0.0 |     -2.405132 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.331267 | 1.331267 |    2.073019 |   0.0 |     1.0 | 1.331267 | 2.331267 |
    | 12.01. |    0.0 |             2.261285 |                    1.0 |          0.0 |     -2.331267 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.261285 | 1.261285 |    1.964044 |   0.0 |     1.0 | 1.261285 | 2.261285 |
    | 13.01. |    0.0 |             2.194981 |                    1.0 |          0.0 |     -2.261285 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.194981 | 1.194981 |    1.860798 |   0.0 |     1.0 | 1.194981 | 2.194981 |
    | 14.01. |    0.0 |             2.132163 |                    1.0 |          0.0 |     -2.194981 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.132163 | 1.132163 |    1.762979 |   0.0 |     1.0 | 1.132163 | 2.132163 |
    | 15.01. |    0.0 |             2.072647 |                    1.0 |          0.0 |     -2.132163 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.072647 | 1.072647 |    1.670302 |   0.0 |     1.0 | 1.072647 | 2.072647 |
    | 16.01. |    0.0 |              2.01626 |                    1.0 |          0.0 |     -2.072647 |                   0.0 |             0.0 |             0.0 |           0.0 |        1.01626 |  1.01626 |    1.582498 |   0.0 |     1.0 |  1.01626 |  2.01626 |
    | 17.01. |    0.0 |             1.962837 |                    1.0 |          0.0 |      -2.01626 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.962837 | 0.962837 |    1.499308 |   0.0 |     1.0 | 0.962837 | 1.962837 |
    | 18.01. |    0.0 |             1.912222 |                    1.0 |          0.0 |     -1.962837 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.912222 | 0.912222 |    1.420492 |   0.0 |     1.0 | 0.912222 | 1.912222 |
    | 19.01. |    0.0 |             1.864268 |                    1.0 |          0.0 |     -1.912222 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.864268 | 0.864268 |     1.34582 |   0.0 |     1.0 | 0.864268 | 1.864268 |
    | 20.01. |    0.0 |             1.818835 |                    1.0 |          0.0 |     -1.864268 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.818835 | 0.818835 |    1.275072 |   0.0 |     1.0 | 0.818835 | 1.818835 |

    .. raw:: html

        <iframe
            src="dam_v001_ex13.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    For a more precise evaluation, you can compare the outflow of the dam
    with the following results of the linear storage cascade with only
    one storage:

    >>> from hydpy.auxs.iuhtools import LinearStorageCascade
    >>> lsc = LinearStorageCascade(n=1, k=1.0/0.054)
    >>> round_(numpy.convolve(lsc.ma.coefs, input_.sequences.sim.series)[:20])
    0.0, 0.02652, 0.183776, 0.543037, 0.961081, 1.251541, 1.395548, 1.453371, 1.455585, 1.405116, 1.331252, 1.261271, 1.194968, 1.132151, 1.072636, 1.01625, 0.962828, 0.912214, 0.864261, 0.818829

    The largest difference occurs on January, 1. But this difference of
    0.000054 m³/s is way below the required accuracy of 0.01 m³/s.  There
    is no guarantee that the actual numerical error will always fall below
    the defined tolerance value.  However, if everything works well, we
    should at least expect so for the individual simulation time step,
    as the actual error should be better as the error estimate by one order.
    On the other hand, the accumulation of errors of individual simulation
    time steps is not controlled and might sometimes result in an violation
    of the defined tolerance value.

    To achieve the results discussed above, about 4 calls of the methods
    of the dam model were required:

    >>> model.numvars.nmb_calls
    78
    >>> model.numvars.nmb_calls = 0

    .. _dam_v001_ex14:

    **Example 14**

    If we set the tolerance value to 1e-6 m³/s, the printed table shows
    (six decimal places) no deviation from the analytical solution of the
    linear storage:

    >>> solver.abserrormax(1e-6)
    >>> test('dam_v001_ex14')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |         0.0 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 02.01. |    1.0 |              1.02652 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |        0.02652 |  0.02652 |    0.084109 |   1.0 |     1.0 |  0.02652 |  1.02652 |
    | 03.01. |    5.0 |             1.183776 |                    1.0 |          0.0 |      -1.02652 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.183776 | 0.183776 |     0.50023 |   5.0 |     1.0 | 0.183776 | 1.183776 |
    | 04.01. |    9.0 |             1.543037 |                    1.0 |          0.0 |     -1.183776 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.543037 | 0.543037 |    1.230912 |   9.0 |     1.0 | 0.543037 | 1.543037 |
    | 05.01. |    8.0 |             1.961081 |                    1.0 |          0.0 |     -1.543037 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.961081 | 0.961081 |    1.839075 |   8.0 |     1.0 | 0.961081 | 1.961081 |
    | 06.01. |    5.0 |             2.251541 |                    1.0 |          0.0 |     -1.961081 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.251541 | 1.251541 |    2.162941 |   5.0 |     1.0 | 1.251541 | 2.251541 |
    | 07.01. |    3.0 |             2.395548 |                    1.0 |          0.0 |     -2.251541 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.395548 | 1.395548 |    2.301566 |   3.0 |     1.0 | 1.395548 | 2.395548 |
    | 08.01. |    2.0 |             2.453371 |                    1.0 |          0.0 |     -2.395548 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.453371 | 1.453371 |    2.348795 |   2.0 |     1.0 | 1.453371 | 2.453371 |
    | 09.01. |    1.0 |             2.455585 |                    1.0 |          0.0 |     -2.453371 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.455585 | 1.455585 |    2.309432 |   1.0 |     1.0 | 1.455585 | 2.455585 |
    | 10.01. |    0.0 |             2.405116 |                    1.0 |          0.0 |     -2.455585 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.405116 | 1.405116 |     2.18803 |   0.0 |     1.0 | 1.405116 | 2.405116 |
    | 11.01. |    0.0 |             2.331252 |                    1.0 |          0.0 |     -2.405116 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.331252 | 1.331252 |     2.07301 |   0.0 |     1.0 | 1.331252 | 2.331252 |
    | 12.01. |    0.0 |             2.261271 |                    1.0 |          0.0 |     -2.331252 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.261271 | 1.261271 |    1.964036 |   0.0 |     1.0 | 1.261271 | 2.261271 |
    | 13.01. |    0.0 |             2.194968 |                    1.0 |          0.0 |     -2.261271 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.194968 | 1.194968 |    1.860791 |   0.0 |     1.0 | 1.194968 | 2.194968 |
    | 14.01. |    0.0 |             2.132151 |                    1.0 |          0.0 |     -2.194968 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.132151 | 1.132151 |    1.762973 |   0.0 |     1.0 | 1.132151 | 2.132151 |
    | 15.01. |    0.0 |             2.072636 |                    1.0 |          0.0 |     -2.132151 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.072636 | 1.072636 |    1.670297 |   0.0 |     1.0 | 1.072636 | 2.072636 |
    | 16.01. |    0.0 |              2.01625 |                    1.0 |          0.0 |     -2.072636 |                   0.0 |             0.0 |             0.0 |           0.0 |        1.01625 |  1.01625 |    1.582493 |   0.0 |     1.0 |  1.01625 |  2.01625 |
    | 17.01. |    0.0 |             1.962828 |                    1.0 |          0.0 |      -2.01625 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.962828 | 0.962828 |    1.499305 |   0.0 |     1.0 | 0.962828 | 1.962828 |
    | 18.01. |    0.0 |             1.912214 |                    1.0 |          0.0 |     -1.962828 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.912214 | 0.912214 |     1.42049 |   0.0 |     1.0 | 0.912214 | 1.912214 |
    | 19.01. |    0.0 |             1.864261 |                    1.0 |          0.0 |     -1.912214 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.864261 | 0.864261 |    1.345818 |   0.0 |     1.0 | 0.864261 | 1.864261 |
    | 20.01. |    0.0 |             1.818829 |                    1.0 |          0.0 |     -1.864261 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.818829 | 0.818829 |    1.275071 |   0.0 |     1.0 | 0.818829 | 1.818829 |

    .. raw:: html

        <iframe
            src="dam_v001_ex14.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    However, this improvement in accuracy increases the computation time
    significantly.  Now 10.5 calls were required on average:

    >>> model.numvars.nmb_calls
    211
    >>> model.numvars.nmb_calls = 0

    .. _dam_v001_ex15:

    **Example 15**

    Now we reset the local error tolerance to the more realistic value.
    But we configure the |WaterLevel2FloodDischarge| parameter in a
    highly reactive manner:

    >>> solver.abserrormax(1e-2)
    >>> waterlevel2flooddischarge(ann(
    ...         weights_input=1e-4, weights_output=1e7,
    ...         intercepts_hidden=0.0, intercepts_output=-1e7/2))
    >>> waterlevel2flooddischarge.plot(0.0, 25.0)

    .. testsetup::

        >>> pyplot.close()

    With this new parameterization of the dam model, the linear storage
    coefficient is approximately 5.4 per day.  This is why the following
    test results show virtually no retention effects:

    >>> test('dam_v001_ex15')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input | natural |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |         0.0 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 02.01. |    1.0 |             1.818699 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.818699 | 0.818699 |    0.015664 |   1.0 |     1.0 | 0.818699 | 1.818699 |
    | 03.01. |    5.0 |              5.25814 |                    1.0 |          0.0 |     -1.818699 |                   0.0 |             0.0 |             0.0 |           0.0 |        4.25814 |  4.25814 |    0.079761 |   5.0 |     1.0 |  4.25814 |  5.25814 |
    | 04.01. |    9.0 |             9.259255 |                    1.0 |          0.0 |      -5.25814 |                   0.0 |             0.0 |             0.0 |           0.0 |       8.259255 | 8.259255 |    0.143761 |   9.0 |     1.0 | 8.259255 | 9.259255 |
    | 05.01. |    8.0 |             9.178598 |                    1.0 |          0.0 |     -9.259255 |                   0.0 |             0.0 |             0.0 |           0.0 |       8.178598 | 8.178598 |    0.128331 |   8.0 |     1.0 | 8.178598 | 9.178598 |
    | 06.01. |    5.0 |             6.555424 |                    1.0 |          0.0 |     -9.178598 |                   0.0 |             0.0 |             0.0 |           0.0 |       5.555424 | 5.555424 |    0.080342 |   5.0 |     1.0 | 5.555424 | 6.555424 |
    | 07.01. |    3.0 |             4.371696 |                    1.0 |          0.0 |     -6.555424 |                   0.0 |             0.0 |             0.0 |           0.0 |       3.371696 | 3.371696 |    0.048227 |   3.0 |     1.0 | 3.371696 | 4.371696 |
    | 08.01. |    2.0 |             3.183878 |                    1.0 |          0.0 |     -4.371696 |                   0.0 |             0.0 |             0.0 |           0.0 |       2.183878 | 2.183878 |     0.03234 |   2.0 |     1.0 | 2.183878 | 3.183878 |
    | 09.01. |    1.0 |             2.185158 |                    1.0 |          0.0 |     -3.183878 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.185158 | 1.185158 |    0.016343 |   1.0 |     1.0 | 1.185158 | 2.185158 |
    | 10.01. |    0.0 |             1.188656 |                    1.0 |          0.0 |     -2.185158 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.187346 | 0.188656 |    0.000043 |   0.0 |     1.0 | 0.188656 | 1.188656 |
    | 11.01. |    0.0 |             1.001338 |                    1.0 |          0.0 |     -1.188656 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 | 0.001338 |   -0.000073 |   0.0 |     1.0 | 0.001338 | 1.001338 |
    | 12.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |     -1.001338 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 13.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 14.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 15.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 16.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 17.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 18.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 19.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |
    | 20.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       -0.00455 |      0.0 |   -0.000073 |   0.0 |     1.0 |      0.0 |      1.0 |

    .. raw:: html

        <iframe
            src="dam_v001_ex15.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    The following calculations show that the dam model reaches the required
    numerical for this extreme parameterizations:

    >>> lsc.k = 1.0/5.4
    >>> round_(numpy.convolve(lsc.ma.coefs, input_.sequences.sim.series)[:20])
    0.0, 0.815651, 4.261772, 8.259271, 8.181003, 5.553864, 3.371199, 2.186025, 1.185189, 0.185185, 0.000836, 0.000004, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0

    However, due to the potential stiffness of this parameterization, the
    division of the different simulation steps into some substeps were
    required.  This increased the average required number of model methods
    calls to 19 per simulation step:

    >>> model.numvars.nmb_calls
    358
    >>> model.numvars.nmb_calls = 0

    Also note that the final water volume is negative due the limited
    numerical accuracy of the results.

    For common (realistic) simulations of dam retention processes, the
    stability issue disussed here should not be of big relevance.
    But one should keep it in mind when playing around with parameters
    e.g. during model calibration.  Otherwise unexpectedly long simulation
    durations might occur.

"""
# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.auxs.anntools import ann
# ...from dam
from hydpy.models.dam import dam_model
from hydpy.models.dam import dam_control
from hydpy.models.dam import dam_derived
from hydpy.models.dam import dam_solver
from hydpy.models.dam import dam_fluxes
from hydpy.models.dam import dam_states
from hydpy.models.dam import dam_logs
from hydpy.models.dam import dam_aides
from hydpy.models.dam import dam_inlets
from hydpy.models.dam import dam_outlets
from hydpy.models.dam import dam_receivers


class Model(modeltools.ModelELS):
    """Version 1 of HydPy-Dam."""

    _INLET_METHODS = (dam_model.pic_inflow_v1,
                      dam_model.calc_naturalremotedischarge_v1,
                      dam_model.calc_remotedemand_v1,
                      dam_model.calc_remotefailure_v1,
                      dam_model.calc_requiredremoterelease_v1,
                      dam_model.calc_requiredrelease_v1,
                      dam_model.calc_targetedrelease_v1)
    _RECEIVER_METHODS = (dam_model.pic_totalremotedischarge_v1,
                         dam_model.update_loggedtotalremotedischarge_v1)
    _PART_ODE_METHODS = (dam_model.pic_inflow_v1,
                         dam_model.calc_waterlevel_v1,
                         dam_model.calc_actualrelease_v1,
                         dam_model.calc_flooddischarge_v1,
                         dam_model.calc_outflow_v1)
    _FULL_ODE_METHODS = (dam_model.update_watervolume_v1,)
    _OUTLET_METHODS = (dam_model.pass_outflow_v1,
                       dam_model.update_loggedoutflow_v1)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-Dam, Version 1."""
    _PARCLASSES = (dam_control.CatchmentArea,
                   dam_control.NmbLogEntries,
                   dam_control.RemoteDischargeMinimum,
                   dam_control.RemoteDischargeSafety,
                   dam_control.NearDischargeMinimumThreshold,
                   dam_control.NearDischargeMinimumTolerance,
                   dam_control.RestrictTargetedRelease,
                   dam_control.WaterLevelMinimumThreshold,
                   dam_control.WaterLevelMinimumTolerance,
                   dam_control.WaterVolume2WaterLevel,
                   dam_control.WaterLevel2FloodDischarge)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-Dam, Version 1."""
    _PARCLASSES = (dam_derived.TOY,
                   dam_derived.Seconds,
                   dam_derived.RemoteDischargeSmoothPar,
                   dam_derived.NearDischargeMinimumSmoothPar1,
                   dam_derived.NearDischargeMinimumSmoothPar2,
                   dam_derived.WaterLevelMinimumSmoothPar)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of HydPy-Dam, Version 1."""
    _PARCLASSES = (dam_solver.AbsErrorMax,
                   dam_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_fluxes.Inflow,
                   dam_fluxes.TotalRemoteDischarge,
                   dam_fluxes.NaturalRemoteDischarge,
                   dam_fluxes.RemoteDemand,
                   dam_fluxes.RemoteFailure,
                   dam_fluxes.RequiredRemoteRelease,
                   dam_fluxes.RequiredRelease,
                   dam_fluxes.TargetedRelease,
                   dam_fluxes.ActualRelease,
                   dam_fluxes.FloodDischarge,
                   dam_fluxes.Outflow)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_states.WaterVolume,)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_logs.LoggedTotalRemoteDischarge,
                   dam_logs.LoggedOutflow)


class AideSequences(sequencetools.AideSequences):
    """State sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_aides.WaterLevel,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_outlets.Q,)


class ReceiverSequences(sequencetools.LinkSequences):
    """Information link sequences of HydPy-Dam, Version 1."""
    _SEQCLASSES = (dam_receivers.Q,)


autodoc_applicationmodel()


# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v002.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""Version 2 of HydPy-Dam.

Application model |dam_v002| is a simplification of |dam_v001|.
While most functionlities are identical, |dam_v002| does not calculate
|RequiredRemoteRelease| on its own, but picks this information from
the simulation results of another model.

The following explanations focus on this difference.  For further
information on the usage of |dam_v002| please read the documentation
on model |dam_v001|.

Integration examples:

    Each of the following examples is a repetition of an example performed
    to demonstrate the functionality of model |dam_v001|.  To achieve
    comparability, identical parameter values and initial conditions are set.
    Additionally, the values of sequence |RequiredRemoteRelease| calculated
    by |dam_v001| in the respective example are used as input data of
    |dam_v002| via the node object `remote`.  (Note that this nodes handles
    variable |dam_receivers.D|). Due to the limit precision of the
    copy-pasted |RequiredRemoteRelease| values, there are some tiny
    deviations between the results of both models.

    :ref:`Recalculation of example 7 <dam_v001_ex07>`

    The general time- and space-related set up is identical, except that
    no other models need to bee included to construct meaningful examples:

    >>> from hydpy import pub, Timegrid, Timegrids
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '21.01.2000',
    ...                                    '1d'))
    >>> from hydpy import Node
    >>> input_ = Node('input')
    >>> output = Node('output')
    >>> remote = Node('remote', variable='D')
    >>> from hydpy import Element
    >>> dam = Element('dam', inlets=input_, outlets=output, receivers=remote)
    >>> from hydpy.models.dam_v002 import *
    >>> parameterstep('1d')
    >>> dam.connect(model)

    Next, all initial conditions and the external input time series data
    are defined.  Note that the first value of |RequiredRemoteRelease|
    calculated by model |dam_v001| is inserted as an initial condition
    via the `test` object and all other values are passed to the series
    object of node `remote`:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 200
    >>> IntegrationTest.plotting_options.activated=(
    ...     fluxes.inflow, fluxes.outflow)
    >>> test = IntegrationTest(
    ...     dam,
    ...     inits=((states.watervolume, 0.0),
    ...            (logs.loggedrequiredremoterelease, 0.005)))
    >>> test.dateformat = '%d.%m.'
    >>> input_.sequences.sim.series = 1.0
    >>> remote.sequences.sim.series = [
    ...     0.008588, 0.010053, 0.013858, 0.027322, 0.064075,
    ...     0.235523, 0.470414, 0.735001, 0.891263, 0.696325,
    ...     0.349797, 0.105231, 0.111928, 0.240436, 0.229369,
    ...     0.058622, 0.016958, 0.008447, 0.004155, 0.0]

    Except that |dam_v002| implements less parameters
    than |dam_v001|, all parameter settings are identical:

    >>> watervolume2waterlevel(
    ...         weights_input=1e-6, weights_output=1e6,
    ...         intercepts_hidden=0.0, intercepts_output=-1e6/2)
    >>> waterlevel2flooddischarge(ann(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0))
    >>> catchmentarea(86.4)
    >>> neardischargeminimumthreshold(0.2)
    >>> neardischargeminimumtolerance(0.2)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> restricttargetedrelease(True)
    >>> parameters.update()

    The following test results confirm that both models behave identical
    under low flow conditions both when there is a "near" and/or a "remote"
    need for water supply:

    >>> test('dam_v002_ex7')
    |   date | inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input |   output |   remote |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 0.005 |        0.210526 |        0.210526 |      0.201754 |            0.0 | 0.201754 |    0.068968 |   1.0 | 0.201754 | 0.008588 |
    | 02.01. |    1.0 |              0.008588 |         0.21092 |         0.21092 |       0.21092 |            0.0 |  0.21092 |    0.137145 |   1.0 |  0.21092 | 0.010053 |
    | 03.01. |    1.0 |              0.010053 |        0.211084 |        0.211084 |      0.211084 |            0.0 | 0.211084 |    0.205307 |   1.0 | 0.211084 | 0.013858 |
    | 04.01. |    1.0 |              0.013858 |        0.211523 |        0.211523 |      0.211523 |            0.0 | 0.211523 |    0.273432 |   1.0 | 0.211523 | 0.027322 |
    | 05.01. |    1.0 |              0.027322 |        0.213209 |        0.213209 |      0.213209 |            0.0 | 0.213209 |     0.34141 |   1.0 | 0.213209 | 0.064075 |
    | 06.01. |    1.0 |              0.064075 |        0.219043 |        0.219043 |      0.219043 |            0.0 | 0.219043 |    0.408885 |   1.0 | 0.219043 | 0.235523 |
    | 07.01. |    1.0 |              0.235523 |        0.283419 |        0.283419 |      0.283419 |            0.0 | 0.283419 |    0.470798 |   1.0 | 0.283419 | 0.470414 |
    | 08.01. |    1.0 |              0.470414 |        0.475211 |        0.475211 |      0.475211 |            0.0 | 0.475211 |    0.516139 |   1.0 | 0.475211 | 0.735001 |
    | 09.01. |    1.0 |              0.735001 |         0.73528 |         0.73528 |       0.73528 |            0.0 |  0.73528 |    0.539011 |   1.0 |  0.73528 | 0.891263 |
    | 10.01. |    1.0 |              0.891263 |        0.891314 |        0.891314 |      0.891314 |            0.0 | 0.891314 |    0.548402 |   1.0 | 0.891314 | 0.696325 |
    | 11.01. |    1.0 |              0.696325 |         0.69675 |         0.69675 |       0.69675 |            0.0 |  0.69675 |    0.574602 |   1.0 |  0.69675 | 0.349797 |
    | 12.01. |    1.0 |              0.349797 |        0.366407 |        0.366407 |      0.366407 |            0.0 | 0.366407 |    0.629345 |   1.0 | 0.366407 | 0.105231 |
    | 13.01. |    1.0 |              0.105231 |        0.228241 |        0.228241 |      0.228241 |            0.0 | 0.228241 |    0.696025 |   1.0 | 0.228241 | 0.111928 |
    | 14.01. |    1.0 |              0.111928 |        0.230054 |        0.230054 |      0.230054 |            0.0 | 0.230054 |    0.762548 |   1.0 | 0.230054 | 0.240436 |
    | 15.01. |    1.0 |              0.240436 |        0.286374 |        0.286374 |      0.286374 |            0.0 | 0.286374 |    0.824205 |   1.0 | 0.286374 | 0.229369 |
    | 16.01. |    1.0 |              0.229369 |        0.279807 |        0.279807 |      0.279807 |            0.0 | 0.279807 |     0.88643 |   1.0 | 0.279807 | 0.058622 |
    | 17.01. |    1.0 |              0.058622 |         0.21805 |         0.21805 |       0.21805 |            0.0 |  0.21805 |    0.953991 |   1.0 |  0.21805 | 0.016958 |
    | 18.01. |    1.0 |              0.016958 |        0.211893 |        0.211893 |      0.211893 |            0.0 | 0.211893 |    1.022083 |   1.0 | 0.211893 | 0.008447 |
    | 19.01. |    1.0 |              0.008447 |        0.210904 |        0.210904 |      0.210904 |            0.0 | 0.210904 |    1.090261 |   1.0 | 0.210904 | 0.004155 |
    | 20.01. |    1.0 |              0.004155 |        0.210435 |        0.210435 |      0.210435 |            0.0 | 0.210435 |    1.158479 |   1.0 | 0.210435 |      0.0 |

    .. raw:: html

        <iframe
            src="dam_v002_ex7.html"
            width="100%"
            height="230px"
            frameborder=0
        ></iframe>


    :ref:`Recalculation of example 8.1 <dam_v001_ex08_1>`

    The next recalculation confirms that the restriction on releasing
    water when there is little inflow works as explained for model
    |dam_v001|:

    >>> input_.sequences.sim.series[10:] = 0.1
    >>> remote.sequences.sim.series = [
    ...     0.008746, 0.010632, 0.015099, 0.03006, 0.068641,
    ...     0.242578, 0.474285, 0.784512, 0.95036, 0.35,
    ...     0.034564, 0.299482, 0.585979, 0.557422, 0.229369,
    ...     0.142578, 0.068641, 0.029844, 0.012348, 0.0]
    >>> neardischargeminimumtolerance(0.0)
    >>> test('dam_v002_ex8_1')
    |   date | inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input |   output |   remote |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 0.005 |             0.2 |             0.2 |      0.191667 |            0.0 | 0.191667 |     0.06984 |   1.0 | 0.191667 | 0.008746 |
    | 02.01. |    1.0 |              0.008746 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.13896 |   1.0 |      0.2 | 0.010632 |
    | 03.01. |    1.0 |              0.010632 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.20808 |   1.0 |      0.2 | 0.015099 |
    | 04.01. |    1.0 |              0.015099 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |      0.2772 |   1.0 |      0.2 |  0.03006 |
    | 05.01. |    1.0 |               0.03006 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.34632 |   1.0 |      0.2 | 0.068641 |
    | 06.01. |    1.0 |              0.068641 |             0.2 |             0.2 |           0.2 |            0.0 |      0.2 |     0.41544 |   1.0 |      0.2 | 0.242578 |
    | 07.01. |    1.0 |              0.242578 |        0.242578 |        0.242578 |      0.242578 |            0.0 | 0.242578 |    0.480881 |   1.0 | 0.242578 | 0.474285 |
    | 08.01. |    1.0 |              0.474285 |        0.474285 |        0.474285 |      0.474285 |            0.0 | 0.474285 |    0.526303 |   1.0 | 0.474285 | 0.784512 |
    | 09.01. |    1.0 |              0.784512 |        0.784512 |        0.784512 |      0.784512 |            0.0 | 0.784512 |    0.544921 |   1.0 | 0.784512 |  0.95036 |
    | 10.01. |    1.0 |               0.95036 |         0.95036 |         0.95036 |       0.95036 |            0.0 |  0.95036 |     0.54921 |   1.0 |  0.95036 |     0.35 |
    | 11.01. |    0.1 |                  0.35 |            0.35 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.034564 |
    | 12.01. |    0.1 |              0.034564 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.299482 |
    | 13.01. |    0.1 |              0.299482 |        0.299482 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.585979 |
    | 14.01. |    0.1 |              0.585979 |        0.585979 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.557422 |
    | 15.01. |    0.1 |              0.557422 |        0.557422 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.229369 |
    | 16.01. |    0.1 |              0.229369 |        0.229369 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.142578 |
    | 17.01. |    0.1 |              0.142578 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.068641 |
    | 18.01. |    0.1 |              0.068641 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.029844 |
    | 19.01. |    0.1 |              0.029844 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 | 0.012348 |
    | 20.01. |    0.1 |              0.012348 |             0.2 |             0.1 |           0.1 |            0.0 |      0.1 |     0.54921 |   0.1 |      0.1 |      0.0 |

    .. raw:: html

        <iframe
            src="dam_v002_ex8_1.html"
            width="100%"
            height="230px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 10 <dam_v001_ex10>`

    The last recalculation for low flow conditions deals with a case where
    the available water storage is too limited to supply enough discharge:

    >>> input_.sequences.sim.series = numpy.linspace(0.2, 0.0, 20)
    >>> neardischargeminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.01)
    >>> waterlevelminimumthreshold(0.005)
    >>> remote.sequences.sim.series = [
    ...     0.01232, 0.029323, 0.064084, 0.120198, 0.247367,
    ...     0.45567, 0.608464, 0.537314, 0.629775, 0.744091,
    ...     0.82219, 0.841916, 0.701812, 0.533258, 0.351863,
    ...     0.185207, 0.107697, 0.055458, 0.025948, 0.0]
    >>> test('dam_v008_ex10')
    |   date |   inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume |    input |   output |   remote |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |      0.2 |                 0.005 |           0.005 |           0.005 |      0.001282 |            0.0 | 0.001282 |    0.017169 |      0.2 | 0.001282 |  0.01232 |
    | 02.01. | 0.189474 |               0.01232 |         0.01232 |         0.01232 |      0.007624 |            0.0 | 0.007624 |    0.032881 | 0.189474 | 0.007624 | 0.029323 |
    | 03.01. | 0.178947 |              0.029323 |        0.029323 |        0.029323 |      0.025921 |            0.0 | 0.025921 |    0.046103 | 0.178947 | 0.025921 | 0.064084 |
    | 04.01. | 0.168421 |              0.064084 |        0.064084 |        0.064084 |      0.062021 |            0.0 | 0.062021 |    0.055296 | 0.168421 | 0.062021 | 0.120198 |
    | 05.01. | 0.157895 |              0.120198 |        0.120198 |        0.120198 |      0.118479 |            0.0 | 0.118479 |    0.058701 | 0.157895 | 0.118479 | 0.247367 |
    | 06.01. | 0.147368 |              0.247367 |        0.247367 |        0.247367 |      0.242243 |            0.0 | 0.242243 |    0.050504 | 0.147368 | 0.242243 |  0.45567 |
    | 07.01. | 0.136842 |               0.45567 |         0.45567 |         0.45567 |      0.397328 |            0.0 | 0.397328 |    0.027998 | 0.136842 | 0.397328 | 0.608464 |
    | 08.01. | 0.126316 |              0.608464 |        0.608464 |        0.608464 |      0.290762 |            0.0 | 0.290762 |     0.01379 | 0.126316 | 0.290762 | 0.537314 |
    | 09.01. | 0.115789 |              0.537314 |        0.537314 |        0.537314 |      0.154283 |            0.0 | 0.154283 |    0.010464 | 0.115789 | 0.154283 | 0.629775 |
    | 10.01. | 0.105263 |              0.629775 |        0.629775 |        0.629775 |      0.138519 |            0.0 | 0.138519 |    0.007591 | 0.105263 | 0.138519 | 0.744091 |
    | 11.01. | 0.094737 |              0.744091 |        0.744091 |        0.744091 |      0.126207 |            0.0 | 0.126207 |    0.004871 | 0.094737 | 0.126207 |  0.82219 |
    | 12.01. | 0.084211 |               0.82219 |         0.82219 |         0.82219 |      0.109723 |            0.0 | 0.109723 |    0.002667 | 0.084211 | 0.109723 | 0.841916 |
    | 13.01. | 0.073684 |              0.841916 |        0.841916 |        0.841916 |      0.092645 |            0.0 | 0.092645 |    0.001029 | 0.073684 | 0.092645 | 0.701812 |
    | 14.01. | 0.063158 |              0.701812 |        0.701812 |        0.701812 |      0.068806 |            0.0 | 0.068806 |    0.000541 | 0.063158 | 0.068806 | 0.533258 |
    | 15.01. | 0.052632 |              0.533258 |        0.533258 |        0.533258 |      0.051779 |            0.0 | 0.051779 |    0.000615 | 0.052632 | 0.051779 | 0.351863 |
    | 16.01. | 0.042105 |              0.351863 |        0.351863 |        0.351863 |      0.035499 |            0.0 | 0.035499 |    0.001185 | 0.042105 | 0.035499 | 0.185207 |
    | 17.01. | 0.031579 |              0.185207 |        0.185207 |        0.185207 |       0.02024 |            0.0 |  0.02024 |    0.002165 | 0.031579 |  0.02024 | 0.107697 |
    | 18.01. | 0.021053 |              0.107697 |        0.107697 |        0.107697 |      0.012785 |            0.0 | 0.012785 |    0.002879 | 0.021053 | 0.012785 | 0.055458 |
    | 19.01. | 0.010526 |              0.055458 |        0.055458 |        0.055458 |      0.006918 |            0.0 | 0.006918 |    0.003191 | 0.010526 | 0.006918 | 0.025948 |
    | 20.01. |      0.0 |              0.025948 |        0.025948 |        0.012974 |      0.001631 |            0.0 | 0.001631 |     0.00305 |      0.0 | 0.001631 |      0.0 |


    :ref:`Recalculation of example 13 <dam_v001_ex13>`

    The final recalculation shows the equality of both models under
    high flow conditions:

    >>> neardischargeminimumthreshold(0.0)
    >>> neardischargeminimumtolerance(0.0)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> waterlevel2flooddischarge(ann(
    ...         weights_input=1e-6, weights_output=1e7,
    ...         intercepts_hidden=0.0, intercepts_output=-1e7/2))

    >>> neardischargeminimumthreshold(0.0)
    >>> input_.sequences.sim.series = [ 0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...                                 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
    >>> remote.sequences.sim.series = 0.0
    >>> test.inits.loggedrequiredremoterelease = 0.0
    >>> test('dam_v002_ex13')
    |   date | inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | flooddischarge |  outflow | watervolume | input |   output | remote |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |            0.0 |      0.0 |         0.0 |   0.0 |      0.0 |    0.0 |
    | 02.01. |    1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.026514 | 0.026514 |    0.084109 |   1.0 | 0.026514 |    0.0 |
    | 03.01. |    5.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.183744 | 0.183744 |    0.500234 |   5.0 | 0.183744 |    0.0 |
    | 04.01. |    9.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.542983 | 0.542983 |     1.23092 |   9.0 | 0.542983 |    0.0 |
    | 05.01. |    8.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.961039 | 0.961039 |    1.839086 |   8.0 | 0.961039 |    0.0 |
    | 06.01. |    5.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.251523 | 1.251523 |    2.162955 |   5.0 | 1.251523 |    0.0 |
    | 07.01. |    3.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.395546 | 1.395546 |    2.301579 |   3.0 | 1.395546 |    0.0 |
    | 08.01. |    2.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.453375 | 1.453375 |    2.348808 |   2.0 | 1.453375 |    0.0 |
    | 09.01. |    1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.455596 | 1.455596 |    2.309444 |   1.0 | 1.455596 |    0.0 |
    | 10.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.405132 | 1.405132 |    2.188041 |   0.0 | 1.405132 |    0.0 |
    | 11.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.331267 | 1.331267 |    2.073019 |   0.0 | 1.331267 |    0.0 |
    | 12.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.261285 | 1.261285 |    1.964044 |   0.0 | 1.261285 |    0.0 |
    | 13.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.194981 | 1.194981 |    1.860798 |   0.0 | 1.194981 |    0.0 |
    | 14.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.132163 | 1.132163 |    1.762979 |   0.0 | 1.132163 |    0.0 |
    | 15.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       1.072647 | 1.072647 |    1.670302 |   0.0 | 1.072647 |    0.0 |
    | 16.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |        1.01626 |  1.01626 |    1.582498 |   0.0 |  1.01626 |    0.0 |
    | 17.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.962837 | 0.962837 |    1.499308 |   0.0 | 0.962837 |    0.0 |
    | 18.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.912222 | 0.912222 |    1.420492 |   0.0 | 0.912222 |    0.0 |
    | 19.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.864268 | 0.864268 |     1.34582 |   0.0 | 0.864268 |    0.0 |
    | 20.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |       0.818835 | 0.818835 |    1.275072 |   0.0 | 0.818835 |    0.0 |

    .. raw:: html

        <iframe
            src="dam_v002_ex13.html"
            width="100%"
            height="230px"
            frameborder=0
        ></iframe>
"""

# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.auxs.anntools import ann
# ...from dam
from hydpy.models.dam import dam_model
from hydpy.models.dam import dam_control
from hydpy.models.dam import dam_derived
from hydpy.models.dam import dam_solver
from hydpy.models.dam import dam_fluxes
from hydpy.models.dam import dam_states
from hydpy.models.dam import dam_logs
from hydpy.models.dam import dam_aides
from hydpy.models.dam import dam_inlets
from hydpy.models.dam import dam_outlets
from hydpy.models.dam import dam_receivers


class Model(modeltools.ModelELS):
    """Version 2 of HydPy-Dam."""

    _INLET_METHODS = (dam_model.pic_inflow_v1,
                      dam_model.calc_requiredremoterelease_v2,
                      dam_model.calc_requiredrelease_v1,
                      dam_model.calc_targetedrelease_v1)
    _RECEIVER_METHODS = (dam_model.pic_loggedrequiredremoterelease_v1,)
    _PART_ODE_METHODS = (dam_model.pic_inflow_v1,
                         dam_model.calc_waterlevel_v1,
                         dam_model.calc_actualrelease_v1,
                         dam_model.calc_flooddischarge_v1,
                         dam_model.calc_outflow_v1)
    _FULL_ODE_METHODS = (dam_model.update_watervolume_v1,)
    _OUTLET_METHODS = (dam_model.pass_outflow_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-Dam, Version 2."""
    _PARCLASSES = (dam_control.CatchmentArea,
                   dam_control.NearDischargeMinimumThreshold,
                   dam_control.NearDischargeMinimumTolerance,
                   dam_control.RestrictTargetedRelease,
                   dam_control.WaterLevelMinimumThreshold,
                   dam_control.WaterLevelMinimumTolerance,
                   dam_control.WaterVolume2WaterLevel,
                   dam_control.WaterLevel2FloodDischarge)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-Dam, Version 2."""
    _PARCLASSES = (dam_derived.TOY,
                   dam_derived.Seconds,
                   dam_derived.NearDischargeMinimumSmoothPar1,
                   dam_derived.NearDischargeMinimumSmoothPar2,
                   dam_derived.WaterLevelMinimumSmoothPar)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of HydPy-Dam, Version 2."""
    _PARCLASSES = (dam_solver.AbsErrorMax,
                   dam_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_fluxes.Inflow,
                   dam_fluxes.RequiredRemoteRelease,
                   dam_fluxes.RequiredRelease,
                   dam_fluxes.TargetedRelease,
                   dam_fluxes.ActualRelease,
                   dam_fluxes.FloodDischarge,
                   dam_fluxes.Outflow)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_states.WaterVolume,)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_logs.LoggedRequiredRemoteRelease,)


class AideSequences(sequencetools.AideSequences):
    """State sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_aides.WaterLevel,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_outlets.Q,)


class ReceiverSequences(sequencetools.LinkSequences):
    """Information link sequences of HydPy-Dam, Version 2."""
    _SEQCLASSES = (dam_receivers.D,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v003.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""Version 3 of HydPy-Dam

Application |dam_v003| is quite similar to model |dam_v002|.  Both
possess the same flood retentions functionalities.  Also, both models
try to meet a remote water demand.  The only difference is that model
|dam_v002| assumes the demand to occur in the channel downstream
(usually to increase low discharge values), whereas model |dam_v003|
is supposed to supply water to different locations (e.g. to a drinking
water treatment plant).  Hence |dam_v002| releases its output only via
one path and |dam_v003| splits its output into two separate paths.

Integration examples:

    To test the functionalities of |dam_v002|, four integration examples
    of |dam_v001| are recalculated.  We again make use of these examples
    and focus our explanations on the differences only.  So please follow
    the links for further information.

    .. _dam_v003_ex07:

    :ref:`Recalculation of example 7 <dam_v001_ex07>`

    While the time-related set up is identical, the spatial set up needs
    to be changed.  Instead of one output node, there a now two nodes,
    called `release` (into the stream bed) and `supply` (e.g. for a
    drinking water supply treatment plant).  The node `demand` defines
    the amount of water required by the plant:

    >>> from hydpy import pub, Timegrid, Timegrids, Node, Element
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '21.01.2000',
    ...                                    '1d'))
    >>> inflow = Node('inflow', variable='Q')
    >>> release = Node('release', variable='Q')
    >>> supply = Node('supply', variable='S')
    >>> demand = Node('demand', variable='S')
    >>> dam = Element('dam',
    ...               inlets=inflow,
    ...               outlets=(release, supply),
    ...               receivers=demand)
    >>> from hydpy.models.dam_v003 import *
    >>> parameterstep('1d')
    >>> dam.connect(model)

    Method |Model.connect| recognizes the different purposes of both
    output nodes through the given `variable` keyword.  Each |dam_v003|
    model must be connecte  to exactly two nodes.  The `Q`-node
    (discharge) handles the release into the stream bed downstream and
    the `S`-node (supply) passes the water flow to another (arbitrary) model.

    As explained for model |dam_v002|, the following initial conditions,
    external time series data, and parameter values are set in favour of
    making the simulation results as comparable as possible:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 250
    >>> IntegrationTest.plotting_options.activated=(
    ...     fluxes.inflow, fluxes.outflow)
    >>> test = IntegrationTest(
    ...     dam,
    ...     inits=((states.watervolume, 0.0),
    ...            (logs.loggedrequiredremoterelease, 0.005)))
    >>> test.dateformat = '%d.%m.'
    >>> inflow.sequences.sim.series = 1.0
    >>> demand.sequences.sim.series = [
    ...     0.008588, 0.010053, 0.013858, 0.027322, 0.064075,
    ...     0.235523, 0.470414, 0.735001, 0.891263, 0.696325,
    ...     0.349797, 0.105231, 0.111928, 0.240436, 0.229369,
    ...     0.058622, 0.016958, 0.008447, 0.004155, 0.0]
    >>> watervolume2waterlevel(
    ...         weights_input=1e-6, weights_output=1e6,
    ...         intercepts_hidden=0.0, intercepts_output=-1e6/2)
    >>> waterlevel2flooddischarge(ann(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0))
    >>> catchmentarea(86.4)
    >>> neardischargeminimumthreshold(0.2)
    >>> neardischargeminimumtolerance(0.2)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> waterlevelminimumremotethreshold(0.0)
    >>> waterlevelminimumremotetolerance(0.0)
    >>> restricttargetedrelease(True)
    >>> parameters.update()

    Despite trying to make this example comparable with
    :ref:`example 7 <dam_v001_ex07>` of model |dam_v001| (and the
    corresponding recalculation of model |dam_v002|), there are relevant
    differences in the results.  These are due to the separate output
    paths of model |dam_v003|.  Models |dam_v001| and |dam_v002| use the
    same water to both meet the near and the remote demand.  This is not
    possible for model |dam_v003|,  which is why it has to release a larger
    total amount of water:

    >>> test('dam_v003_ex7')
    |   date | inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume |   demand | inflow |  release |   supply |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 0.005 |             0.2 |             0.2 |      0.191667 |            0.004792 |            0.0 | 0.191667 |    0.069426 | 0.008588 |    1.0 | 0.191667 | 0.004792 |
    | 02.01. |    1.0 |              0.008588 |             0.2 |             0.2 |           0.2 |            0.008588 |            0.0 |      0.2 |    0.137804 | 0.010053 |    1.0 |      0.2 | 0.008588 |
    | 03.01. |    1.0 |              0.010053 |             0.2 |             0.2 |           0.2 |            0.010053 |            0.0 |      0.2 |    0.206055 | 0.013858 |    1.0 |      0.2 | 0.010053 |
    | 04.01. |    1.0 |              0.013858 |             0.2 |             0.2 |           0.2 |            0.013858 |            0.0 |      0.2 |    0.273978 | 0.027322 |    1.0 |      0.2 | 0.013858 |
    | 05.01. |    1.0 |              0.027322 |             0.2 |             0.2 |           0.2 |            0.027322 |            0.0 |      0.2 |    0.340737 | 0.064075 |    1.0 |      0.2 | 0.027322 |
    | 06.01. |    1.0 |              0.064075 |             0.2 |             0.2 |           0.2 |            0.064075 |            0.0 |      0.2 |    0.404321 | 0.235523 |    1.0 |      0.2 | 0.064075 |
    | 07.01. |    1.0 |              0.235523 |             0.2 |             0.2 |           0.2 |            0.235523 |            0.0 |      0.2 |    0.453092 | 0.470414 |    1.0 |      0.2 | 0.235523 |
    | 08.01. |    1.0 |              0.470414 |             0.2 |             0.2 |           0.2 |            0.470414 |            0.0 |      0.2 |    0.481568 | 0.735001 |    1.0 |      0.2 | 0.470414 |
    | 09.01. |    1.0 |              0.735001 |             0.2 |             0.2 |           0.2 |            0.735001 |            0.0 |      0.2 |    0.487184 | 0.891263 |    1.0 |      0.2 | 0.735001 |
    | 10.01. |    1.0 |              0.891263 |             0.2 |             0.2 |           0.2 |            0.891263 |            0.0 |      0.2 |    0.479299 | 0.696325 |    1.0 |      0.2 | 0.891263 |
    | 11.01. |    1.0 |              0.696325 |             0.2 |             0.2 |           0.2 |            0.696325 |            0.0 |      0.2 |    0.488257 | 0.349797 |    1.0 |      0.2 | 0.696325 |
    | 12.01. |    1.0 |              0.349797 |             0.2 |             0.2 |           0.2 |            0.349797 |            0.0 |      0.2 |    0.527154 | 0.105231 |    1.0 |      0.2 | 0.349797 |
    | 13.01. |    1.0 |              0.105231 |             0.2 |             0.2 |           0.2 |            0.105231 |            0.0 |      0.2 |    0.587182 | 0.111928 |    1.0 |      0.2 | 0.105231 |
    | 14.01. |    1.0 |              0.111928 |             0.2 |             0.2 |           0.2 |            0.111928 |            0.0 |      0.2 |    0.646632 | 0.240436 |    1.0 |      0.2 | 0.111928 |
    | 15.01. |    1.0 |              0.240436 |             0.2 |             0.2 |           0.2 |            0.240436 |            0.0 |      0.2 |    0.694978 | 0.229369 |    1.0 |      0.2 | 0.240436 |
    | 16.01. |    1.0 |              0.229369 |             0.2 |             0.2 |           0.2 |            0.229369 |            0.0 |      0.2 |    0.744281 | 0.058622 |    1.0 |      0.2 | 0.229369 |
    | 17.01. |    1.0 |              0.058622 |             0.2 |             0.2 |           0.2 |            0.058622 |            0.0 |      0.2 |    0.808336 | 0.016958 |    1.0 |      0.2 | 0.058622 |
    | 18.01. |    1.0 |              0.016958 |             0.2 |             0.2 |           0.2 |            0.016958 |            0.0 |      0.2 |     0.87599 | 0.008447 |    1.0 |      0.2 | 0.016958 |
    | 19.01. |    1.0 |              0.008447 |             0.2 |             0.2 |           0.2 |            0.008447 |            0.0 |      0.2 |    0.944381 | 0.004155 |    1.0 |      0.2 | 0.008447 |
    | 20.01. |    1.0 |              0.004155 |             0.2 |             0.2 |           0.2 |            0.004155 |            0.0 |      0.2 |    1.013142 |      0.0 |    1.0 |      0.2 | 0.004155 |

    .. raw:: html

        <iframe
            src="dam_v003_ex7.html"
            width="100%"
            height="280px"
            frameborder=0
        ></iframe>

    .. _dam_v003_ex08:

    :ref:`Recalculation of example 8.1 <dam_v001_ex08_1>`

    The next recalculation shows that the restriction on releasing
    water during low inflow conditions concerns the release into
    the stream bed only:

    >>> inflow.sequences.sim.series[10:] = 0.1
    >>> demand.sequences.sim.series = [
    ...     0.008746, 0.010632, 0.015099, 0.03006, 0.068641,
    ...     0.242578, 0.474285, 0.784512, 0.95036, 0.35,
    ...     0.034564, 0.299482, 0.585979, 0.557422, 0.229369,
    ...     0.142578, 0.068641, 0.029844, 0.012348, 0.0]
    >>> neardischargeminimumtolerance(0.0)
    >>> test('dam_v003_ex8_1')
    |   date | inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume |   demand | inflow |  release |   supply |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 0.005 |             0.2 |             0.2 |      0.191667 |            0.004792 |            0.0 | 0.191667 |    0.069426 | 0.008746 |    1.0 | 0.191667 | 0.004792 |
    | 02.01. |    1.0 |              0.008746 |             0.2 |             0.2 |           0.2 |            0.008746 |            0.0 |      0.2 |     0.13779 | 0.010632 |    1.0 |      0.2 | 0.008746 |
    | 03.01. |    1.0 |              0.010632 |             0.2 |             0.2 |           0.2 |            0.010632 |            0.0 |      0.2 |    0.205992 | 0.015099 |    1.0 |      0.2 | 0.010632 |
    | 04.01. |    1.0 |              0.015099 |             0.2 |             0.2 |           0.2 |            0.015099 |            0.0 |      0.2 |    0.273807 |  0.03006 |    1.0 |      0.2 | 0.015099 |
    | 05.01. |    1.0 |               0.03006 |             0.2 |             0.2 |           0.2 |             0.03006 |            0.0 |      0.2 |     0.34033 | 0.068641 |    1.0 |      0.2 |  0.03006 |
    | 06.01. |    1.0 |              0.068641 |             0.2 |             0.2 |           0.2 |            0.068641 |            0.0 |      0.2 |    0.403519 | 0.242578 |    1.0 |      0.2 | 0.068641 |
    | 07.01. |    1.0 |              0.242578 |             0.2 |             0.2 |           0.2 |            0.242578 |            0.0 |      0.2 |    0.451681 | 0.474285 |    1.0 |      0.2 | 0.242578 |
    | 08.01. |    1.0 |              0.474285 |             0.2 |             0.2 |           0.2 |            0.474285 |            0.0 |      0.2 |    0.479822 | 0.784512 |    1.0 |      0.2 | 0.474285 |
    | 09.01. |    1.0 |              0.784512 |             0.2 |             0.2 |           0.2 |            0.784512 |            0.0 |      0.2 |    0.481161 |  0.95036 |    1.0 |      0.2 | 0.784512 |
    | 10.01. |    1.0 |               0.95036 |             0.2 |             0.2 |           0.2 |             0.95036 |            0.0 |      0.2 |     0.46817 |     0.35 |    1.0 |      0.2 |  0.95036 |
    | 11.01. |    0.1 |                  0.35 |             0.2 |             0.1 |           0.1 |                0.35 |            0.0 |      0.1 |     0.43793 | 0.034564 |    0.1 |      0.1 |     0.35 |
    | 12.01. |    0.1 |              0.034564 |             0.2 |             0.1 |           0.1 |            0.034564 |            0.0 |      0.1 |    0.434943 | 0.299482 |    0.1 |      0.1 | 0.034564 |
    | 13.01. |    0.1 |              0.299482 |             0.2 |             0.1 |           0.1 |            0.299482 |            0.0 |      0.1 |    0.409068 | 0.585979 |    0.1 |      0.1 | 0.299482 |
    | 14.01. |    0.1 |              0.585979 |             0.2 |             0.1 |           0.1 |            0.585979 |            0.0 |      0.1 |    0.358439 | 0.557422 |    0.1 |      0.1 | 0.585979 |
    | 15.01. |    0.1 |              0.557422 |             0.2 |             0.1 |           0.1 |            0.557422 |            0.0 |      0.1 |    0.310278 | 0.229369 |    0.1 |      0.1 | 0.557422 |
    | 16.01. |    0.1 |              0.229369 |             0.2 |             0.1 |           0.1 |            0.229369 |            0.0 |      0.1 |    0.290461 | 0.142578 |    0.1 |      0.1 | 0.229369 |
    | 17.01. |    0.1 |              0.142578 |             0.2 |             0.1 |           0.1 |            0.142578 |            0.0 |      0.1 |    0.278142 | 0.068641 |    0.1 |      0.1 | 0.142578 |
    | 18.01. |    0.1 |              0.068641 |             0.2 |             0.1 |           0.1 |            0.068641 |            0.0 |      0.1 |    0.272211 | 0.029844 |    0.1 |      0.1 | 0.068641 |
    | 19.01. |    0.1 |              0.029844 |             0.2 |             0.1 |           0.1 |            0.029844 |            0.0 |      0.1 |    0.269633 | 0.012348 |    0.1 |      0.1 | 0.029844 |
    | 20.01. |    0.1 |              0.012348 |             0.2 |             0.1 |           0.1 |            0.012348 |            0.0 |      0.1 |    0.268566 |      0.0 |    0.1 |      0.1 | 0.012348 |

    .. raw:: html

        <iframe
            src="dam_v003_ex8_1.html"
            width="100%"
            height="280px"
            frameborder=0
        ></iframe>

    .. _dam_v003_ex10:

    :ref:`Recalculation of example 10 <dam_v001_ex10>`

    This example makes use of two control parameters which are unknown to
    models |dam_v001| and |dam_v002|.  |WaterLevelMinimumRemoteThreshold|
    and |WaterLevelMinimumRemoteTolerance| are introduced to allow for a
    distinct control of both dam output paths for situations when the
    available storage becomes limited.  Here, parameter
    |WaterLevelMinimumRemoteThreshold| is set to a higher value than
    parameter |WaterLevelMinimumThreshold|, meaning the release into the
    stream bed has a higher priority than the supply to the drinking water
    treatment plant:

    >>> inflow.sequences.sim.series = numpy.linspace(0.2, 0.0, 20)
    >>> waterlevelminimumtolerance(0.01)
    >>> waterlevelminimumthreshold(0.005)
    >>> waterlevelminimumremotetolerance(0.01)
    >>> waterlevelminimumremotethreshold(0.01)
    >>> demand.sequences.sim.series = [
    ...     0.01232, 0.029323, 0.064084, 0.120198, 0.247367,
    ...     0.45567, 0.608464, 0.537314, 0.629775, 0.744091,
    ...     0.82219, 0.841916, 0.701812, 0.533258, 0.351863,
    ...     0.185207, 0.107697, 0.055458, 0.025948, 0.0]
    >>> test('dam_v003_ex10')
    |   date |   inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume |   demand |   inflow |  release |   supply |
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |      0.2 |                 0.005 |             0.2 |             0.2 |      0.038491 |             0.00012 |            0.0 | 0.038491 |    0.013944 |  0.01232 |      0.2 | 0.038491 |  0.00012 |
    | 02.01. | 0.189474 |               0.01232 |             0.2 |        0.189474 |      0.086988 |            0.000993 |            0.0 | 0.086988 |    0.022713 | 0.029323 | 0.189474 | 0.086988 | 0.000993 |
    | 03.01. | 0.178947 |              0.029323 |             0.2 |        0.178947 |      0.116103 |            0.004642 |            0.0 | 0.116103 |    0.027742 | 0.064084 | 0.178947 | 0.116103 | 0.004642 |
    | 04.01. | 0.168421 |              0.064084 |             0.2 |        0.168421 |      0.125159 |            0.014625 |            0.0 | 0.125159 |    0.030216 | 0.120198 | 0.168421 | 0.125159 | 0.014625 |
    | 05.01. | 0.157895 |              0.120198 |             0.2 |        0.157895 |      0.121681 |            0.030361 |            0.0 | 0.121681 |    0.030722 | 0.247367 | 0.157895 | 0.121681 | 0.030361 |
    | 06.01. | 0.147368 |              0.247367 |             0.2 |        0.147368 |      0.109923 |            0.056857 |            0.0 | 0.109923 |    0.029044 |  0.45567 | 0.147368 | 0.109923 | 0.056857 |
    | 07.01. | 0.136842 |               0.45567 |             0.2 |        0.136842 |      0.094858 |            0.084715 |            0.0 | 0.094858 |    0.025352 | 0.608464 | 0.136842 | 0.094858 | 0.084715 |
    | 08.01. | 0.126316 |              0.608464 |             0.2 |        0.126316 |      0.076914 |            0.082553 |            0.0 | 0.076914 |    0.022488 | 0.537314 | 0.126316 | 0.076914 | 0.082553 |
    | 09.01. | 0.115789 |              0.537314 |             0.2 |        0.115789 |      0.064167 |            0.059779 |            0.0 | 0.064167 |    0.021783 | 0.629775 | 0.115789 | 0.064167 | 0.059779 |
    | 10.01. | 0.105263 |              0.629775 |             0.2 |        0.105263 |      0.055154 |            0.063011 |            0.0 | 0.055154 |    0.020669 | 0.744091 | 0.105263 | 0.055154 | 0.063011 |
    | 11.01. | 0.094737 |              0.744091 |             0.2 |        0.094737 |      0.045986 |            0.064865 |            0.0 | 0.045986 |    0.019277 |  0.82219 | 0.094737 | 0.045986 | 0.064865 |
    | 12.01. | 0.084211 |               0.82219 |             0.2 |        0.084211 |      0.037699 |             0.06228 |            0.0 | 0.037699 |    0.017914 | 0.841916 | 0.084211 | 0.037699 |  0.06228 |
    | 13.01. | 0.073684 |              0.841916 |             0.2 |        0.073684 |      0.030632 |            0.056377 |            0.0 | 0.030632 |    0.016763 | 0.701812 | 0.073684 | 0.030632 | 0.056377 |
    | 14.01. | 0.063158 |              0.701812 |             0.2 |        0.063158 |      0.025166 |            0.043828 |            0.0 | 0.025166 |    0.016259 | 0.533258 | 0.063158 | 0.025166 | 0.043828 |
    | 15.01. | 0.052632 |              0.533258 |             0.2 |        0.052632 |      0.020693 |            0.032602 |            0.0 | 0.020693 |    0.016201 | 0.351863 | 0.052632 | 0.020693 | 0.032602 |
    | 16.01. | 0.042105 |              0.351863 |             0.2 |        0.042105 |      0.016736 |            0.021882 |            0.0 | 0.016736 |    0.016502 | 0.185207 | 0.042105 | 0.016736 | 0.021882 |
    | 17.01. | 0.031579 |              0.185207 |             0.2 |        0.031579 |      0.012934 |            0.012076 |            0.0 | 0.012934 |     0.01707 | 0.107697 | 0.031579 | 0.012934 | 0.012076 |
    | 18.01. | 0.021053 |              0.107697 |             0.2 |        0.021053 |      0.008901 |            0.007386 |            0.0 | 0.008901 |    0.017482 | 0.055458 | 0.021053 | 0.008901 | 0.007386 |
    | 19.01. | 0.010526 |              0.055458 |             0.2 |        0.010526 |      0.004535 |             0.00392 |            0.0 | 0.004535 |    0.017661 | 0.025948 | 0.010526 | 0.004535 |  0.00392 |
    | 20.01. |      0.0 |              0.025948 |             0.2 |             0.0 |           0.0 |            0.001835 |            0.0 |      0.0 |    0.017502 |      0.0 |      0.0 |      0.0 | 0.001835 |

    .. raw:: html

        <iframe
            src="dam_v003_ex10.html"
            width="100%"
            height="280px"
            frameborder=0
        ></iframe>


    .. _dam_v003_ex13:

    :ref:`Recalculation of example 13 <dam_v001_ex13>`

    The final example deals with high flow conditions.  It demonstrates
    that model |dam_v003| calculates the same outflow values as model
    |dam_v001| and model |dam_v002| if there is neither a relevant near
    nor a relevant remote demand:

    >>> neardischargeminimumthreshold(0.0)
    >>> neardischargeminimumtolerance(0.0)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> waterlevelminimumremotethreshold(0.0)
    >>> waterlevelminimumremotetolerance(0.0)
    >>> waterlevel2flooddischarge(ann(
    ...         weights_input=1e-6, weights_output=1e7,
    ...         intercepts_hidden=0.0, intercepts_output=-1e7/2))
    >>> neardischargeminimumthreshold(0.0)
    >>> inflow.sequences.sim.series = [ 0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...                                 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
    >>> demand.sequences.sim.series = 0.0
    >>> test.inits.loggedrequiredremoterelease = 0.0
    >>> test('dam_v003_ex13')
    |   date | inflow | requiredremoterelease | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | demand | inflow |  release | supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |            0.0 |      0.0 |         0.0 |    0.0 |    0.0 |      0.0 |    0.0 |
    | 02.01. |    1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.026514 | 0.026514 |    0.084109 |    0.0 |    1.0 | 0.026514 |    0.0 |
    | 03.01. |    5.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.183744 | 0.183744 |    0.500234 |    0.0 |    5.0 | 0.183744 |    0.0 |
    | 04.01. |    9.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.542983 | 0.542983 |     1.23092 |    0.0 |    9.0 | 0.542983 |    0.0 |
    | 05.01. |    8.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.961039 | 0.961039 |    1.839086 |    0.0 |    8.0 | 0.961039 |    0.0 |
    | 06.01. |    5.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.251523 | 1.251523 |    2.162955 |    0.0 |    5.0 | 1.251523 |    0.0 |
    | 07.01. |    3.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.395546 | 1.395546 |    2.301579 |    0.0 |    3.0 | 1.395546 |    0.0 |
    | 08.01. |    2.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.453375 | 1.453375 |    2.348808 |    0.0 |    2.0 | 1.453375 |    0.0 |
    | 09.01. |    1.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.455596 | 1.455596 |    2.309444 |    0.0 |    1.0 | 1.455596 |    0.0 |
    | 10.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.405132 | 1.405132 |    2.188041 |    0.0 |    0.0 | 1.405132 |    0.0 |
    | 11.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.331267 | 1.331267 |    2.073019 |    0.0 |    0.0 | 1.331267 |    0.0 |
    | 12.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.261285 | 1.261285 |    1.964044 |    0.0 |    0.0 | 1.261285 |    0.0 |
    | 13.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.194981 | 1.194981 |    1.860798 |    0.0 |    0.0 | 1.194981 |    0.0 |
    | 14.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.132163 | 1.132163 |    1.762979 |    0.0 |    0.0 | 1.132163 |    0.0 |
    | 15.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.072647 | 1.072647 |    1.670302 |    0.0 |    0.0 | 1.072647 |    0.0 |
    | 16.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |        1.01626 |  1.01626 |    1.582498 |    0.0 |    0.0 |  1.01626 |    0.0 |
    | 17.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.962837 | 0.962837 |    1.499308 |    0.0 |    0.0 | 0.962837 |    0.0 |
    | 18.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.912222 | 0.912222 |    1.420492 |    0.0 |    0.0 | 0.912222 |    0.0 |
    | 19.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.864268 | 0.864268 |     1.34582 |    0.0 |    0.0 | 0.864268 |    0.0 |
    | 20.01. |    0.0 |                   0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.818835 | 0.818835 |    1.275072 |    0.0 |    0.0 | 0.818835 |    0.0 |

    .. raw:: html

        <iframe
            src="dam_v003_ex13.html"
            width="100%"
            height="280px"
            frameborder=0
        ></iframe>
"""

# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.auxs.anntools import ann
# ...from dam
from hydpy.models.dam import dam_model
from hydpy.models.dam import dam_control
from hydpy.models.dam import dam_derived
from hydpy.models.dam import dam_solver
from hydpy.models.dam import dam_fluxes
from hydpy.models.dam import dam_states
from hydpy.models.dam import dam_logs
from hydpy.models.dam import dam_aides
from hydpy.models.dam import dam_inlets
from hydpy.models.dam import dam_outlets
from hydpy.models.dam import dam_receivers


class Model(modeltools.ModelELS):
    """Version 3 of HydPy-Dam."""

    _INLET_METHODS = (dam_model.pic_inflow_v1,
                      dam_model.calc_requiredremoterelease_v2,
                      dam_model.calc_requiredrelease_v2,
                      dam_model.calc_targetedrelease_v1)
    _RECEIVER_METHODS = (dam_model.pic_loggedrequiredremoterelease_v2,)
    _PART_ODE_METHODS = (dam_model.pic_inflow_v1,
                         dam_model.calc_waterlevel_v1,
                         dam_model.calc_actualrelease_v1,
                         dam_model.calc_actualremoterelease_v1,
                         dam_model.calc_flooddischarge_v1,
                         dam_model.calc_outflow_v1)
    _FULL_ODE_METHODS = (dam_model.update_watervolume_v2,)
    _OUTLET_METHODS = (dam_model.pass_outflow_v1,
                       dam_model.pass_actualremoterelease_v1)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-Dam, Version 3."""
    _PARCLASSES = (dam_control.CatchmentArea,
                   dam_control.NearDischargeMinimumThreshold,
                   dam_control.NearDischargeMinimumTolerance,
                   dam_control.RestrictTargetedRelease,
                   dam_control.WaterLevelMinimumThreshold,
                   dam_control.WaterLevelMinimumTolerance,
                   dam_control.WaterLevelMinimumRemoteThreshold,
                   dam_control.WaterLevelMinimumRemoteTolerance,
                   dam_control.WaterVolume2WaterLevel,
                   dam_control.WaterLevel2FloodDischarge)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-Dam, Version 3."""
    _PARCLASSES = (dam_derived.TOY,
                   dam_derived.Seconds,
                   dam_derived.NearDischargeMinimumSmoothPar1,
                   dam_derived.WaterLevelMinimumSmoothPar,
                   dam_derived.WaterLevelMinimumRemoteSmoothPar)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of HydPy-Dam, Version 3."""
    _PARCLASSES = (dam_solver.AbsErrorMax,
                   dam_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_fluxes.Inflow,
                   dam_fluxes.RequiredRemoteRelease,
                   dam_fluxes.RequiredRelease,
                   dam_fluxes.TargetedRelease,
                   dam_fluxes.ActualRelease,
                   dam_fluxes.ActualRemoteRelease,
                   dam_fluxes.FloodDischarge,
                   dam_fluxes.Outflow)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_states.WaterVolume,)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_logs.LoggedRequiredRemoteRelease,)


class AideSequences(sequencetools.AideSequences):
    """State sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_aides.WaterLevel,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_outlets.Q,
                   dam_outlets.S)


class ReceiverSequences(sequencetools.LinkSequences):
    """Information link sequences of HydPy-Dam, Version 3."""
    _SEQCLASSES = (dam_receivers.S,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v004.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""Version 4 of HydPy-Dam

    Application model |dam_v004| is an extension if model |dam_v003|.
    Both models are able to discharge water into the channel downstream
    and to remote locations.  The difference is that |dam_v003|
    can discharge water only to a single remote location, e.g. to a
    drinking water treatment plant, while |dam_v004| is also able to
    discharge water to a separate remote location independently, e.g.
    to relieve water during high flow conditions.

    Integration examples:

    The following examples are based on the ones of application model
    |dam_v003|, which in turn are taken from the documentation on
    application model |dam_v001|.  So please follow the links for more
    detailed explanations.

    :ref:`Exact recalculation of example 7 <dam_v003_ex07>`

    In addition to the general configuration of application model
    |dam_v003|, two additional node connections are required:
    one node is supposed to provide the information on the maximum
    allowed relieve discharge, and the other one is supposed to pass
    the actual relieve discharge to a remote location. For both
    nodes handle the variable `R`, while nodes `required_suppy` and
    `actual_supply` still handle variable `S`:

    >>> from hydpy import pub, Timegrid, Timegrids, Node, Element
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '21.01.2000',
    ...                                    '1d'))
    >>> inflow = Node('inflow', variable='Q')
    >>> required_supply = Node('required_supply', variable='S')
    >>> allowed_relieve = Node('allowed_relieve', variable='R')
    >>> outflow = Node('release', variable='Q')
    >>> actual_supply = Node('actual_supply', variable='S')
    >>> actual_relieve = Node('actual_relieve', variable='R')
    >>> dam = Element('dam',
    ...               inlets=inflow,
    ...               outlets=(outflow, actual_supply, actual_relieve),
    ...               receivers=(required_supply, allowed_relieve))
    >>> from hydpy.models.dam_v004 import *
    >>> parameterstep('1d')
    >>> dam.connect(model)

    The first test calculation is supposed to show that model |dam_v004|
    behaves exactly like model |dam_v003| when the relieve discharge is
    disabled, which can be accomplished by the following settings:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.activated=(
    ...     fluxes.inflow, fluxes.outflow)
    >>> test = IntegrationTest(
    ...     dam,
    ...     inits=((states.watervolume, 0.0),
    ...            (logs.loggedrequiredremoterelease, 0.005),
    ...            (logs.loggedallowedremoterelieve, 0.0)))
    >>> test.dateformat = '%d.%m.'
    >>> inflow.sequences.sim.series = 1.0
    >>> required_supply.sequences.sim.series = [
    ...     0.008588, 0.010053, 0.013858, 0.027322, 0.064075,
    ...     0.235523, 0.470414, 0.735001, 0.891263, 0.696325,
    ...     0.349797, 0.105231, 0.111928, 0.240436, 0.229369,
    ...     0.058622, 0.016958, 0.008447, 0.004155, 0.0]
    >>> allowed_relieve.sequences.sim.series = 0.0
    >>> watervolume2waterlevel(
    ...         weights_input=1e-6, weights_output=1e6,
    ...         intercepts_hidden=0.0, intercepts_output=-1e6/2)
    >>> waterlevel2flooddischarge(ann(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0))
    >>> catchmentarea(86.4)
    >>> neardischargeminimumthreshold(0.2)
    >>> neardischargeminimumtolerance(0.2)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> waterlevelminimumremotethreshold(0.0)
    >>> waterlevelminimumremotetolerance(0.0)
    >>> waterlevel2possibleremoterelieve(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0)
    >>> remoterelievetolerance(0.0)
    >>> highestremotedischarge(inf)
    >>> highestremotetolerance(0.1)
    >>> restricttargetedrelease(True)
    >>> parameters.update()

    Comparing the results of the following table with the ones shown for
    application model |dam_v004| (e.g. of column `waterlevel` or
    `actualremoterelease`) shows that both models can in fact be
    functionally identical:

    >>> test('dam_v004_ex7')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 0.005 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |      0.191667 |            0.004792 |            0.0 | 0.191667 |    0.069426 |            0.0 |      0.004792 |             0.0 |    1.0 | 0.191667 |        0.008588 |
    | 02.01. |    1.0 |              0.008588 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.008588 |            0.0 |      0.2 |    0.137804 |            0.0 |      0.008588 |             0.0 |    1.0 |      0.2 |        0.010053 |
    | 03.01. |    1.0 |              0.010053 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.010053 |            0.0 |      0.2 |    0.206055 |            0.0 |      0.010053 |             0.0 |    1.0 |      0.2 |        0.013858 |
    | 04.01. |    1.0 |              0.013858 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.013858 |            0.0 |      0.2 |    0.273978 |            0.0 |      0.013858 |             0.0 |    1.0 |      0.2 |        0.027322 |
    | 05.01. |    1.0 |              0.027322 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.027322 |            0.0 |      0.2 |    0.340737 |            0.0 |      0.027322 |             0.0 |    1.0 |      0.2 |        0.064075 |
    | 06.01. |    1.0 |              0.064075 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.064075 |            0.0 |      0.2 |    0.404321 |            0.0 |      0.064075 |             0.0 |    1.0 |      0.2 |        0.235523 |
    | 07.01. |    1.0 |              0.235523 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.235523 |            0.0 |      0.2 |    0.453092 |            0.0 |      0.235523 |             0.0 |    1.0 |      0.2 |        0.470414 |
    | 08.01. |    1.0 |              0.470414 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.470414 |            0.0 |      0.2 |    0.481568 |            0.0 |      0.470414 |             0.0 |    1.0 |      0.2 |        0.735001 |
    | 09.01. |    1.0 |              0.735001 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.735001 |            0.0 |      0.2 |    0.487184 |            0.0 |      0.735001 |             0.0 |    1.0 |      0.2 |        0.891263 |
    | 10.01. |    1.0 |              0.891263 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.891263 |            0.0 |      0.2 |    0.479299 |            0.0 |      0.891263 |             0.0 |    1.0 |      0.2 |        0.696325 |
    | 11.01. |    1.0 |              0.696325 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.696325 |            0.0 |      0.2 |    0.488257 |            0.0 |      0.696325 |             0.0 |    1.0 |      0.2 |        0.349797 |
    | 12.01. |    1.0 |              0.349797 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.349797 |            0.0 |      0.2 |    0.527154 |            0.0 |      0.349797 |             0.0 |    1.0 |      0.2 |        0.105231 |
    | 13.01. |    1.0 |              0.105231 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.105231 |            0.0 |      0.2 |    0.587182 |            0.0 |      0.105231 |             0.0 |    1.0 |      0.2 |        0.111928 |
    | 14.01. |    1.0 |              0.111928 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.111928 |            0.0 |      0.2 |    0.646632 |            0.0 |      0.111928 |             0.0 |    1.0 |      0.2 |        0.240436 |
    | 15.01. |    1.0 |              0.240436 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.240436 |            0.0 |      0.2 |    0.694978 |            0.0 |      0.240436 |             0.0 |    1.0 |      0.2 |        0.229369 |
    | 16.01. |    1.0 |              0.229369 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.229369 |            0.0 |      0.2 |    0.744281 |            0.0 |      0.229369 |             0.0 |    1.0 |      0.2 |        0.058622 |
    | 17.01. |    1.0 |              0.058622 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.058622 |            0.0 |      0.2 |    0.808336 |            0.0 |      0.058622 |             0.0 |    1.0 |      0.2 |        0.016958 |
    | 18.01. |    1.0 |              0.016958 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.016958 |            0.0 |      0.2 |     0.87599 |            0.0 |      0.016958 |             0.0 |    1.0 |      0.2 |        0.008447 |
    | 19.01. |    1.0 |              0.008447 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.008447 |            0.0 |      0.2 |    0.944381 |            0.0 |      0.008447 |             0.0 |    1.0 |      0.2 |        0.004155 |
    | 20.01. |    1.0 |              0.004155 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.004155 |            0.0 |      0.2 |    1.013142 |            0.0 |      0.004155 |             0.0 |    1.0 |      0.2 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex7.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`First modification of example 7 <dam_v003_ex07>`

    In this first modification of the example above, the "old" required
    supply is taken as the "new" allowed relieve discharge and the "new"
    required supply is set to zero.  Also, the possible relieve discharge
    is set to a very large value (100 m³/s):

    >>> test.inits.loggedrequiredremoterelease = 0.0
    >>> test.inits.loggedallowedremoterelieve = 0.005
    >>> allowed_relieve.sequences.sim.series = (
    ...     required_supply.sequences.sim.series)
    >>> required_supply.sequences.sim.series = 0.0
    >>> waterlevel2possibleremoterelieve(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=100.0)
    >>> waterlevel2possibleremoterelieve.plot(-0.1, 1.0)

    .. testsetup::

        >>> from matplotlib import pyplot
        >>> pyplot.close()

    Due to this setting, the "new" actual relieve discharge is nearly
    identical with the "old" actual supply discharge.  There is only
    a small deviation on the first timestep, which is due to a numerical
    inaccuracy, which is explained in the documentation on application
    model |dam_v001|:

    >>> test('dam_v004_ex7_1')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                   0.0 |                0.005 |                 100.0 |               0.005 |             0.2 |             0.2 |      0.191667 |                 0.0 |            0.0 | 0.191667 |    0.069408 |          0.005 |           0.0 |        0.008588 |    1.0 | 0.191667 |             0.0 |
    | 02.01. |    1.0 |                   0.0 |             0.008588 |                 100.0 |            0.008588 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.137786 |       0.008588 |           0.0 |        0.010053 |    1.0 |      0.2 |             0.0 |
    | 03.01. |    1.0 |                   0.0 |             0.010053 |                 100.0 |            0.010053 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.206037 |       0.010053 |           0.0 |        0.013858 |    1.0 |      0.2 |             0.0 |
    | 04.01. |    1.0 |                   0.0 |             0.013858 |                 100.0 |            0.013858 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.27396 |       0.013858 |           0.0 |        0.027322 |    1.0 |      0.2 |             0.0 |
    | 05.01. |    1.0 |                   0.0 |             0.027322 |                 100.0 |            0.027322 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.340719 |       0.027322 |           0.0 |        0.064075 |    1.0 |      0.2 |             0.0 |
    | 06.01. |    1.0 |                   0.0 |             0.064075 |                 100.0 |            0.064075 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.404303 |       0.064075 |           0.0 |        0.235523 |    1.0 |      0.2 |             0.0 |
    | 07.01. |    1.0 |                   0.0 |             0.235523 |                 100.0 |            0.235523 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.453074 |       0.235523 |           0.0 |        0.470414 |    1.0 |      0.2 |             0.0 |
    | 08.01. |    1.0 |                   0.0 |             0.470414 |                 100.0 |            0.470414 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.48155 |       0.470414 |           0.0 |        0.735001 |    1.0 |      0.2 |             0.0 |
    | 09.01. |    1.0 |                   0.0 |             0.735001 |                 100.0 |            0.735001 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.487166 |       0.735001 |           0.0 |        0.891263 |    1.0 |      0.2 |             0.0 |
    | 10.01. |    1.0 |                   0.0 |             0.891263 |                 100.0 |            0.891263 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.479281 |       0.891263 |           0.0 |        0.696325 |    1.0 |      0.2 |             0.0 |
    | 11.01. |    1.0 |                   0.0 |             0.696325 |                 100.0 |            0.696325 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.488239 |       0.696325 |           0.0 |        0.349797 |    1.0 |      0.2 |             0.0 |
    | 12.01. |    1.0 |                   0.0 |             0.349797 |                 100.0 |            0.349797 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.527136 |       0.349797 |           0.0 |        0.105231 |    1.0 |      0.2 |             0.0 |
    | 13.01. |    1.0 |                   0.0 |             0.105231 |                 100.0 |            0.105231 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.587164 |       0.105231 |           0.0 |        0.111928 |    1.0 |      0.2 |             0.0 |
    | 14.01. |    1.0 |                   0.0 |             0.111928 |                 100.0 |            0.111928 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.646614 |       0.111928 |           0.0 |        0.240436 |    1.0 |      0.2 |             0.0 |
    | 15.01. |    1.0 |                   0.0 |             0.240436 |                 100.0 |            0.240436 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.69496 |       0.240436 |           0.0 |        0.229369 |    1.0 |      0.2 |             0.0 |
    | 16.01. |    1.0 |                   0.0 |             0.229369 |                 100.0 |            0.229369 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.744263 |       0.229369 |           0.0 |        0.058622 |    1.0 |      0.2 |             0.0 |
    | 17.01. |    1.0 |                   0.0 |             0.058622 |                 100.0 |            0.058622 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.808318 |       0.058622 |           0.0 |        0.016958 |    1.0 |      0.2 |             0.0 |
    | 18.01. |    1.0 |                   0.0 |             0.016958 |                 100.0 |            0.016958 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.875972 |       0.016958 |           0.0 |        0.008447 |    1.0 |      0.2 |             0.0 |
    | 19.01. |    1.0 |                   0.0 |             0.008447 |                 100.0 |            0.008447 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.944363 |       0.008447 |           0.0 |        0.004155 |    1.0 |      0.2 |             0.0 |
    | 20.01. |    1.0 |                   0.0 |             0.004155 |                 100.0 |            0.004155 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    1.013124 |       0.004155 |           0.0 |             0.0 |    1.0 |      0.2 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex7_1.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`Second modification of example 7 <dam_v003_ex07>`

    Now we modify the artificial neuronal network
    |WaterLevel2PossibleRemoteRelieve| (in fact, only a single neuron)
    in order to prevent any relieve discharge when the dam is emtpy and
    to set maximum relieve discharge of 0.5 m³/s:

    >>> waterlevel2possibleremoterelieve(
    ...        weights_input=1e30, weights_output=0.5,
    ...        intercepts_hidden=-1e27, intercepts_output=0.0)
    >>> waterlevel2possibleremoterelieve.plot(-0.1, 1.0)

    .. testsetup::

        >>> pyplot.close()

    For very small water levels, the new relationship between possible
    relieve discharge an water level resembles the old relationship
    for calculating the actual actual supply release.  Hence, only
    a very small deviation remains at the first simulation timestep.
    The imposed restriction of 0.5 m³/s results in a reduced relieve
    discharge between January, 9, and January, 11:

    >>> test('dam_v004_ex7_2')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                   0.0 |                0.005 |              0.483333 |            0.004833 |             0.2 |             0.2 |      0.196667 |                 0.0 |            0.0 | 0.196667 |     0.06899 |       0.004833 |           0.0 |        0.008588 |    1.0 | 0.196667 |             0.0 |
    | 02.01. |    1.0 |                   0.0 |             0.008588 |                   0.5 |            0.008588 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.137368 |       0.008588 |           0.0 |        0.010053 |    1.0 |      0.2 |             0.0 |
    | 03.01. |    1.0 |                   0.0 |             0.010053 |                   0.5 |            0.010053 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.20562 |       0.010053 |           0.0 |        0.013858 |    1.0 |      0.2 |             0.0 |
    | 04.01. |    1.0 |                   0.0 |             0.013858 |                   0.5 |            0.013858 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.273542 |       0.013858 |           0.0 |        0.027322 |    1.0 |      0.2 |             0.0 |
    | 05.01. |    1.0 |                   0.0 |             0.027322 |                   0.5 |            0.027322 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.340302 |       0.027322 |           0.0 |        0.064075 |    1.0 |      0.2 |             0.0 |
    | 06.01. |    1.0 |                   0.0 |             0.064075 |                   0.5 |            0.064075 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.403886 |       0.064075 |           0.0 |        0.235523 |    1.0 |      0.2 |             0.0 |
    | 07.01. |    1.0 |                   0.0 |             0.235523 |                   0.5 |            0.235523 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.452657 |       0.235523 |           0.0 |        0.470414 |    1.0 |      0.2 |             0.0 |
    | 08.01. |    1.0 |                   0.0 |             0.470414 |                   0.5 |            0.470414 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.481133 |       0.470414 |           0.0 |        0.735001 |    1.0 |      0.2 |             0.0 |
    | 09.01. |    1.0 |                   0.0 |             0.735001 |                   0.5 |                 0.5 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.507053 |            0.5 |           0.0 |        0.891263 |    1.0 |      0.2 |             0.0 |
    | 10.01. |    1.0 |                   0.0 |             0.891263 |                   0.5 |                 0.5 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.532973 |            0.5 |           0.0 |        0.696325 |    1.0 |      0.2 |             0.0 |
    | 11.01. |    1.0 |                   0.0 |             0.696325 |                   0.5 |                 0.5 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.558893 |            0.5 |           0.0 |        0.349797 |    1.0 |      0.2 |             0.0 |
    | 12.01. |    1.0 |                   0.0 |             0.349797 |                   0.5 |            0.349797 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.59779 |       0.349797 |           0.0 |        0.105231 |    1.0 |      0.2 |             0.0 |
    | 13.01. |    1.0 |                   0.0 |             0.105231 |                   0.5 |            0.105231 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.657818 |       0.105231 |           0.0 |        0.111928 |    1.0 |      0.2 |             0.0 |
    | 14.01. |    1.0 |                   0.0 |             0.111928 |                   0.5 |            0.111928 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.717268 |       0.111928 |           0.0 |        0.240436 |    1.0 |      0.2 |             0.0 |
    | 15.01. |    1.0 |                   0.0 |             0.240436 |                   0.5 |            0.240436 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.765614 |       0.240436 |           0.0 |        0.229369 |    1.0 |      0.2 |             0.0 |
    | 16.01. |    1.0 |                   0.0 |             0.229369 |                   0.5 |            0.229369 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.814917 |       0.229369 |           0.0 |        0.058622 |    1.0 |      0.2 |             0.0 |
    | 17.01. |    1.0 |                   0.0 |             0.058622 |                   0.5 |            0.058622 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.878972 |       0.058622 |           0.0 |        0.016958 |    1.0 |      0.2 |             0.0 |
    | 18.01. |    1.0 |                   0.0 |             0.016958 |                   0.5 |            0.016958 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.946627 |       0.016958 |           0.0 |        0.008447 |    1.0 |      0.2 |             0.0 |
    | 19.01. |    1.0 |                   0.0 |             0.008447 |                   0.5 |            0.008447 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    1.015017 |       0.008447 |           0.0 |        0.004155 |    1.0 |      0.2 |             0.0 |
    | 20.01. |    1.0 |                   0.0 |             0.004155 |                   0.5 |            0.004155 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    1.083778 |       0.004155 |           0.0 |             0.0 |    1.0 |      0.2 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex7_2.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`Third modification of example 7 <dam_v003_ex07>`

    The capped possible relieve discharge in the example above results
    in a discontinuous evolution of the actual relieve discharge.  For
    more smooth transitions, the value of parameter |RemoteRelieveTolerance|
    can be set to values larger than zero, e.g.:

    >>> remoterelievetolerance(0.2)
    >>> test('dam_v004_ex7_3')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                   0.0 |                0.005 |              0.483333 |            0.004833 |             0.2 |             0.2 |      0.196667 |                 0.0 |            0.0 | 0.196667 |     0.06899 |       0.004833 |           0.0 |        0.008588 |    1.0 | 0.196667 |             0.0 |
    | 02.01. |    1.0 |                   0.0 |             0.008588 |                   0.5 |            0.008588 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.137368 |       0.008588 |           0.0 |        0.010053 |    1.0 |      0.2 |             0.0 |
    | 03.01. |    1.0 |                   0.0 |             0.010053 |                   0.5 |            0.010053 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.20562 |       0.010053 |           0.0 |        0.013858 |    1.0 |      0.2 |             0.0 |
    | 04.01. |    1.0 |                   0.0 |             0.013858 |                   0.5 |            0.013858 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.273542 |       0.013858 |           0.0 |        0.027322 |    1.0 |      0.2 |             0.0 |
    | 05.01. |    1.0 |                   0.0 |             0.027322 |                   0.5 |            0.027322 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.340302 |       0.027322 |           0.0 |        0.064075 |    1.0 |      0.2 |             0.0 |
    | 06.01. |    1.0 |                   0.0 |             0.064075 |                   0.5 |            0.064075 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.403886 |       0.064075 |           0.0 |        0.235523 |    1.0 |      0.2 |             0.0 |
    | 07.01. |    1.0 |                   0.0 |             0.235523 |                   0.5 |            0.235352 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.452671 |       0.235352 |           0.0 |        0.470414 |    1.0 |      0.2 |             0.0 |
    | 08.01. |    1.0 |                   0.0 |             0.470414 |                   0.5 |            0.418836 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.485604 |       0.418836 |           0.0 |        0.735001 |    1.0 |      0.2 |             0.0 |
    | 09.01. |    1.0 |                   0.0 |             0.735001 |                   0.5 |            0.472874 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.513868 |       0.472874 |           0.0 |        0.891263 |    1.0 |      0.2 |             0.0 |
    | 10.01. |    1.0 |                   0.0 |             0.891263 |                   0.5 |            0.480688 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.541456 |       0.480688 |           0.0 |        0.696325 |    1.0 |      0.2 |             0.0 |
    | 11.01. |    1.0 |                   0.0 |             0.696325 |                   0.5 |            0.469547 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.570007 |       0.469547 |           0.0 |        0.349797 |    1.0 |      0.2 |             0.0 |
    | 12.01. |    1.0 |                   0.0 |             0.349797 |                   0.5 |            0.342067 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.609573 |       0.342067 |           0.0 |        0.105231 |    1.0 |      0.2 |             0.0 |
    | 13.01. |    1.0 |                   0.0 |             0.105231 |                   0.5 |            0.105231 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.669601 |       0.105231 |           0.0 |        0.111928 |    1.0 |      0.2 |             0.0 |
    | 14.01. |    1.0 |                   0.0 |             0.111928 |                   0.5 |            0.111928 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     0.72905 |       0.111928 |           0.0 |        0.240436 |    1.0 |      0.2 |             0.0 |
    | 15.01. |    1.0 |                   0.0 |             0.240436 |                   0.5 |            0.240219 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.777415 |       0.240219 |           0.0 |        0.229369 |    1.0 |      0.2 |             0.0 |
    | 16.01. |    1.0 |                   0.0 |             0.229369 |                   0.5 |            0.229243 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.826729 |       0.229243 |           0.0 |        0.058622 |    1.0 |      0.2 |             0.0 |
    | 17.01. |    1.0 |                   0.0 |             0.058622 |                   0.5 |            0.058622 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.890784 |       0.058622 |           0.0 |        0.016958 |    1.0 |      0.2 |             0.0 |
    | 18.01. |    1.0 |                   0.0 |             0.016958 |                   0.5 |            0.016958 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    0.958439 |       0.016958 |           0.0 |        0.008447 |    1.0 |      0.2 |             0.0 |
    | 19.01. |    1.0 |                   0.0 |             0.008447 |                   0.5 |            0.008447 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |    1.026829 |       0.008447 |           0.0 |        0.004155 |    1.0 |      0.2 |             0.0 |
    | 20.01. |    1.0 |                   0.0 |             0.004155 |                   0.5 |            0.004155 |             0.2 |             0.2 |           0.2 |                 0.0 |            0.0 |      0.2 |     1.09559 |       0.004155 |           0.0 |             0.0 |    1.0 |      0.2 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex7_3.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`Exact recalculation of example 8 <dam_v003_ex08>`

    This and the following exact recalculations are just thought to
    prove the identical behaviour of the components models |dam_v003|
    and |dam_v004| that have not been utilised in the examples above.
    Therefore the remote relieve discharge is disabled again:

    >>> test.inits.loggedrequiredremoterelease = 0.005
    >>> test.inits.loggedallowedremoterelieve = 0.0
    >>> waterlevelminimumremotetolerance(0.0)
    >>> waterlevel2possibleremoterelieve(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0)
    >>> remoterelievetolerance(0.0)
    >>> allowed_relieve.sequences.sim.series = 0.0

    Now, the identical behaviour regarding releasing water to the
    channel downstream during low flow conditions is demonstrated:

    >>> inflow.sequences.sim.series[10:] = 0.1
    >>> required_supply.sequences.sim.series = [
    ...     0.008746, 0.010632, 0.015099, 0.03006, 0.068641,
    ...     0.242578, 0.474285, 0.784512, 0.95036, 0.35,
    ...     0.034564, 0.299482, 0.585979, 0.557422, 0.229369,
    ...     0.142578, 0.068641, 0.029844, 0.012348, 0.0]
    >>> neardischargeminimumtolerance(0.0)
    >>> test('dam_v004_ex8')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |                 0.005 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |      0.191667 |            0.004792 |            0.0 | 0.191667 |    0.069426 |            0.0 |      0.004792 |             0.0 |    1.0 | 0.191667 |        0.008746 |
    | 02.01. |    1.0 |              0.008746 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.008746 |            0.0 |      0.2 |     0.13779 |            0.0 |      0.008746 |             0.0 |    1.0 |      0.2 |        0.010632 |
    | 03.01. |    1.0 |              0.010632 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.010632 |            0.0 |      0.2 |    0.205992 |            0.0 |      0.010632 |             0.0 |    1.0 |      0.2 |        0.015099 |
    | 04.01. |    1.0 |              0.015099 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.015099 |            0.0 |      0.2 |    0.273807 |            0.0 |      0.015099 |             0.0 |    1.0 |      0.2 |         0.03006 |
    | 05.01. |    1.0 |               0.03006 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |             0.03006 |            0.0 |      0.2 |     0.34033 |            0.0 |       0.03006 |             0.0 |    1.0 |      0.2 |        0.068641 |
    | 06.01. |    1.0 |              0.068641 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.068641 |            0.0 |      0.2 |    0.403519 |            0.0 |      0.068641 |             0.0 |    1.0 |      0.2 |        0.242578 |
    | 07.01. |    1.0 |              0.242578 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.242578 |            0.0 |      0.2 |    0.451681 |            0.0 |      0.242578 |             0.0 |    1.0 |      0.2 |        0.474285 |
    | 08.01. |    1.0 |              0.474285 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.474285 |            0.0 |      0.2 |    0.479822 |            0.0 |      0.474285 |             0.0 |    1.0 |      0.2 |        0.784512 |
    | 09.01. |    1.0 |              0.784512 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |            0.784512 |            0.0 |      0.2 |    0.481161 |            0.0 |      0.784512 |             0.0 |    1.0 |      0.2 |         0.95036 |
    | 10.01. |    1.0 |               0.95036 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |           0.2 |             0.95036 |            0.0 |      0.2 |     0.46817 |            0.0 |       0.95036 |             0.0 |    1.0 |      0.2 |            0.35 |
    | 11.01. |    0.1 |                  0.35 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |                0.35 |            0.0 |      0.1 |     0.43793 |            0.0 |          0.35 |             0.0 |    0.1 |      0.1 |        0.034564 |
    | 12.01. |    0.1 |              0.034564 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.034564 |            0.0 |      0.1 |    0.434943 |            0.0 |      0.034564 |             0.0 |    0.1 |      0.1 |        0.299482 |
    | 13.01. |    0.1 |              0.299482 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.299482 |            0.0 |      0.1 |    0.409068 |            0.0 |      0.299482 |             0.0 |    0.1 |      0.1 |        0.585979 |
    | 14.01. |    0.1 |              0.585979 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.585979 |            0.0 |      0.1 |    0.358439 |            0.0 |      0.585979 |             0.0 |    0.1 |      0.1 |        0.557422 |
    | 15.01. |    0.1 |              0.557422 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.557422 |            0.0 |      0.1 |    0.310278 |            0.0 |      0.557422 |             0.0 |    0.1 |      0.1 |        0.229369 |
    | 16.01. |    0.1 |              0.229369 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.229369 |            0.0 |      0.1 |    0.290461 |            0.0 |      0.229369 |             0.0 |    0.1 |      0.1 |        0.142578 |
    | 17.01. |    0.1 |              0.142578 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.142578 |            0.0 |      0.1 |    0.278142 |            0.0 |      0.142578 |             0.0 |    0.1 |      0.1 |        0.068641 |
    | 18.01. |    0.1 |              0.068641 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.068641 |            0.0 |      0.1 |    0.272211 |            0.0 |      0.068641 |             0.0 |    0.1 |      0.1 |        0.029844 |
    | 19.01. |    0.1 |              0.029844 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.029844 |            0.0 |      0.1 |    0.269633 |            0.0 |      0.029844 |             0.0 |    0.1 |      0.1 |        0.012348 |
    | 20.01. |    0.1 |              0.012348 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.1 |           0.1 |            0.012348 |            0.0 |      0.1 |    0.268566 |            0.0 |      0.012348 |             0.0 |    0.1 |      0.1 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex8.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`Exact recalculation of example 10 <dam_v003_ex10>`

    This example demonstates the identical behaviour of models
    |dam_v003| and |dam_v004| regarding limited storage content:

    >>> inflow.sequences.sim.series = numpy.linspace(0.2, 0.0, 20)
    >>> waterlevelminimumtolerance(0.01)
    >>> waterlevelminimumthreshold(0.005)
    >>> waterlevelminimumremotetolerance(0.01)
    >>> waterlevelminimumremotethreshold(0.01)
    >>> required_supply.sequences.sim.series = [
    ...     0.01232, 0.029323, 0.064084, 0.120198, 0.247367,
    ...     0.45567, 0.608464, 0.537314, 0.629775, 0.744091,
    ...     0.82219, 0.841916, 0.701812, 0.533258, 0.351863,
    ...     0.185207, 0.107697, 0.055458, 0.025948, 0.0]
    >>> test('dam_v004_ex10')
    |   date |   inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve |   inflow |  release | required_supply |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |      0.2 |                 0.005 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.2 |      0.038491 |             0.00012 |            0.0 | 0.038491 |    0.013944 |            0.0 |       0.00012 |             0.0 |      0.2 | 0.038491 |         0.01232 |
    | 02.01. | 0.189474 |               0.01232 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.189474 |      0.086988 |            0.000993 |            0.0 | 0.086988 |    0.022713 |            0.0 |      0.000993 |             0.0 | 0.189474 | 0.086988 |        0.029323 |
    | 03.01. | 0.178947 |              0.029323 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.178947 |      0.116103 |            0.004642 |            0.0 | 0.116103 |    0.027742 |            0.0 |      0.004642 |             0.0 | 0.178947 | 0.116103 |        0.064084 |
    | 04.01. | 0.168421 |              0.064084 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.168421 |      0.125159 |            0.014625 |            0.0 | 0.125159 |    0.030216 |            0.0 |      0.014625 |             0.0 | 0.168421 | 0.125159 |        0.120198 |
    | 05.01. | 0.157895 |              0.120198 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.157895 |      0.121681 |            0.030361 |            0.0 | 0.121681 |    0.030722 |            0.0 |      0.030361 |             0.0 | 0.157895 | 0.121681 |        0.247367 |
    | 06.01. | 0.147368 |              0.247367 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.147368 |      0.109923 |            0.056857 |            0.0 | 0.109923 |    0.029044 |            0.0 |      0.056857 |             0.0 | 0.147368 | 0.109923 |         0.45567 |
    | 07.01. | 0.136842 |               0.45567 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.136842 |      0.094858 |            0.084715 |            0.0 | 0.094858 |    0.025352 |            0.0 |      0.084715 |             0.0 | 0.136842 | 0.094858 |        0.608464 |
    | 08.01. | 0.126316 |              0.608464 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.126316 |      0.076914 |            0.082553 |            0.0 | 0.076914 |    0.022488 |            0.0 |      0.082553 |             0.0 | 0.126316 | 0.076914 |        0.537314 |
    | 09.01. | 0.115789 |              0.537314 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.115789 |      0.064167 |            0.059779 |            0.0 | 0.064167 |    0.021783 |            0.0 |      0.059779 |             0.0 | 0.115789 | 0.064167 |        0.629775 |
    | 10.01. | 0.105263 |              0.629775 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.105263 |      0.055154 |            0.063011 |            0.0 | 0.055154 |    0.020669 |            0.0 |      0.063011 |             0.0 | 0.105263 | 0.055154 |        0.744091 |
    | 11.01. | 0.094737 |              0.744091 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.094737 |      0.045986 |            0.064865 |            0.0 | 0.045986 |    0.019277 |            0.0 |      0.064865 |             0.0 | 0.094737 | 0.045986 |         0.82219 |
    | 12.01. | 0.084211 |               0.82219 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.084211 |      0.037699 |             0.06228 |            0.0 | 0.037699 |    0.017914 |            0.0 |       0.06228 |             0.0 | 0.084211 | 0.037699 |        0.841916 |
    | 13.01. | 0.073684 |              0.841916 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.073684 |      0.030632 |            0.056377 |            0.0 | 0.030632 |    0.016763 |            0.0 |      0.056377 |             0.0 | 0.073684 | 0.030632 |        0.701812 |
    | 14.01. | 0.063158 |              0.701812 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.063158 |      0.025166 |            0.043828 |            0.0 | 0.025166 |    0.016259 |            0.0 |      0.043828 |             0.0 | 0.063158 | 0.025166 |        0.533258 |
    | 15.01. | 0.052632 |              0.533258 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.052632 |      0.020693 |            0.032602 |            0.0 | 0.020693 |    0.016201 |            0.0 |      0.032602 |             0.0 | 0.052632 | 0.020693 |        0.351863 |
    | 16.01. | 0.042105 |              0.351863 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.042105 |      0.016736 |            0.021882 |            0.0 | 0.016736 |    0.016502 |            0.0 |      0.021882 |             0.0 | 0.042105 | 0.016736 |        0.185207 |
    | 17.01. | 0.031579 |              0.185207 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.031579 |      0.012934 |            0.012076 |            0.0 | 0.012934 |     0.01707 |            0.0 |      0.012076 |             0.0 | 0.031579 | 0.012934 |        0.107697 |
    | 18.01. | 0.021053 |              0.107697 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.021053 |      0.008901 |            0.007386 |            0.0 | 0.008901 |    0.017482 |            0.0 |      0.007386 |             0.0 | 0.021053 | 0.008901 |        0.055458 |
    | 19.01. | 0.010526 |              0.055458 |                  0.0 |                   0.0 |                 0.0 |             0.2 |        0.010526 |      0.004535 |             0.00392 |            0.0 | 0.004535 |    0.017661 |            0.0 |       0.00392 |             0.0 | 0.010526 | 0.004535 |        0.025948 |
    | 20.01. |      0.0 |              0.025948 |                  0.0 |                   0.0 |                 0.0 |             0.2 |             0.0 |           0.0 |            0.001835 |            0.0 |      0.0 |    0.017502 |            0.0 |      0.001835 |             0.0 |      0.0 |      0.0 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex10.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`Exact recalculation of example 13 <dam_v003_ex13>`

    This example demonstrates the identical behaviour of models
    |dam_v003| and |dam_v004| (and also of models |dam_v001| and
    |dam_v002| regarding high flow conditions:

    >>> neardischargeminimumthreshold(0.0)
    >>> neardischargeminimumtolerance(0.0)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> waterlevelminimumremotethreshold(0.0)
    >>> waterlevelminimumremotetolerance(0.0)
    >>> waterlevel2flooddischarge(ann(
    ...         weights_input=1e-6, weights_output=1e7,
    ...         intercepts_hidden=0.0, intercepts_output=-1e7/2))
    >>> neardischargeminimumthreshold(0.0)
    >>> inflow.sequences.sim.series = [ 0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...                                 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
    >>> required_supply.sequences.sim.series = 0.0
    >>> test.inits.loggedrequiredremoterelease = 0.0
    >>> test('dam_v004_ex13')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |            0.0 |      0.0 |         0.0 |            0.0 |           0.0 |             0.0 |    0.0 |      0.0 |             0.0 |
    | 02.01. |    1.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.026514 | 0.026514 |    0.084109 |            0.0 |           0.0 |             0.0 |    1.0 | 0.026514 |             0.0 |
    | 03.01. |    5.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.183744 | 0.183744 |    0.500234 |            0.0 |           0.0 |             0.0 |    5.0 | 0.183744 |             0.0 |
    | 04.01. |    9.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.542983 | 0.542983 |     1.23092 |            0.0 |           0.0 |             0.0 |    9.0 | 0.542983 |             0.0 |
    | 05.01. |    8.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.961039 | 0.961039 |    1.839086 |            0.0 |           0.0 |             0.0 |    8.0 | 0.961039 |             0.0 |
    | 06.01. |    5.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.251523 | 1.251523 |    2.162955 |            0.0 |           0.0 |             0.0 |    5.0 | 1.251523 |             0.0 |
    | 07.01. |    3.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.395546 | 1.395546 |    2.301579 |            0.0 |           0.0 |             0.0 |    3.0 | 1.395546 |             0.0 |
    | 08.01. |    2.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.453375 | 1.453375 |    2.348808 |            0.0 |           0.0 |             0.0 |    2.0 | 1.453375 |             0.0 |
    | 09.01. |    1.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.455596 | 1.455596 |    2.309444 |            0.0 |           0.0 |             0.0 |    1.0 | 1.455596 |             0.0 |
    | 10.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.405132 | 1.405132 |    2.188041 |            0.0 |           0.0 |             0.0 |    0.0 | 1.405132 |             0.0 |
    | 11.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.331267 | 1.331267 |    2.073019 |            0.0 |           0.0 |             0.0 |    0.0 | 1.331267 |             0.0 |
    | 12.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.261285 | 1.261285 |    1.964044 |            0.0 |           0.0 |             0.0 |    0.0 | 1.261285 |             0.0 |
    | 13.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.194981 | 1.194981 |    1.860798 |            0.0 |           0.0 |             0.0 |    0.0 | 1.194981 |             0.0 |
    | 14.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.132163 | 1.132163 |    1.762979 |            0.0 |           0.0 |             0.0 |    0.0 | 1.132163 |             0.0 |
    | 15.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       1.072647 | 1.072647 |    1.670302 |            0.0 |           0.0 |             0.0 |    0.0 | 1.072647 |             0.0 |
    | 16.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |        1.01626 |  1.01626 |    1.582498 |            0.0 |           0.0 |             0.0 |    0.0 |  1.01626 |             0.0 |
    | 17.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.962837 | 0.962837 |    1.499308 |            0.0 |           0.0 |             0.0 |    0.0 | 0.962837 |             0.0 |
    | 18.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.912222 | 0.912222 |    1.420492 |            0.0 |           0.0 |             0.0 |    0.0 | 0.912222 |             0.0 |
    | 19.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.864268 | 0.864268 |     1.34582 |            0.0 |           0.0 |             0.0 |    0.0 | 0.864268 |             0.0 |
    | 20.01. |    0.0 |                   0.0 |                  0.0 |                   0.0 |                 0.0 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.818835 | 0.818835 |    1.275072 |            0.0 |           0.0 |             0.0 |    0.0 | 0.818835 |             0.0 |

    .. raw:: html

        <iframe
            src="dam_v004_ex13.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>

    :ref:`Modification of example 13 <dam_v003_ex13>`

    Building on the example above, we demonstrate the possibility to
    constrain |ActualRemoteRelieve| and |ActualRemoteRelease| by setting
    parameter |HighestRemoteDischarge| to 1.0 m³/s, which is the allowed
    sum of both |AllowedRemoteRelieve| and |ActualRemoteRelease|:

    This final example demonstrates the identical behaviour of models
    |dam_v003| and |dam_v004| (and also of models |dam_v001| and
    |dam_v002| regarding high flow conditions:

    >>> test.inits.loggedrequiredremoterelease = 0.5
    >>> required_supply.sequences.sim.series = 0.5
    >>> test.inits.loggedallowedremoterelieve = 0.0
    >>> allowed_relieve.sequences.sim.series = numpy.linspace(0.0, 1.5, 20)
    >>> waterlevelminimumremotethreshold(0.0)
    >>> waterlevel2possibleremoterelieve(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=5.0)
    >>> highestremotedischarge(1.0)
    >>> highestremotetolerance(0.1)

    The following results demonstrate, that |AllowedRemoteRelieve|
    has priority over |ActualRemoteRelease|. |RequiredRemoteRelease| is
    set to a constant value of 0.5 m³/s via node `required_supply`,
    whereas |AllowedRemoteRelieve| increases linearly from 0.0 to 1.5 m³/s.
    Due to parameter |HighestRemoteDischarge| being set to 1.0 m³/s,
    |ActualRemoteRelease| starts to drop when |AllowedRemoteRelieve|
    exceeds 0.5 m³/s, and |AllowedRemoteRelieve| itself does
    never exceede 1 m³/s:

    >>> test('dam_v004_ex13_1')
    |   date | inflow | requiredremoterelease | allowedremoterelieve | possibleremoterelieve | actualremoterelieve | requiredrelease | targetedrelease | actualrelease | actualremoterelease | flooddischarge |  outflow | watervolume | actual_relieve | actual_supply | allowed_relieve | inflow |  release | required_supply |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                   0.5 |                  0.0 |                   5.0 |                 0.0 |             0.0 |             0.0 |           0.0 |              0.0125 |      -0.001125 |      0.0 |    -0.00108 |            0.0 |        0.0125 |             0.0 |    0.0 |      0.0 |             0.5 |
    | 02.01. |    1.0 |                   0.5 |                  0.0 |                   5.0 |                 0.0 |             0.0 |             0.0 |           0.0 |            0.483321 |       0.013893 | 0.013915 |    0.042359 |            0.0 |      0.483321 |        0.078947 |    1.0 | 0.013915 |             0.5 |
    | 03.01. |    5.0 |                   0.5 |             0.078947 |                   5.0 |            0.078947 |             0.0 |             0.0 |           0.0 |            0.499952 |       0.142993 | 0.142993 |    0.411987 |       0.078947 |      0.499952 |        0.157895 |    5.0 | 0.142993 |             0.5 |
    | 04.01. |    9.0 |                   0.5 |             0.157895 |                   5.0 |            0.157895 |             0.0 |             0.0 |           0.0 |            0.499819 |       0.471852 | 0.471852 |    1.091993 |       0.157895 |      0.499819 |        0.236842 |    9.0 | 0.471852 |             0.5 |
    | 05.01. |    8.0 |                   0.5 |             0.236842 |                   5.0 |            0.236842 |             0.0 |             0.0 |           0.0 |            0.499314 |       0.856993 | 0.856993 |    1.645545 |       0.236842 |      0.499314 |        0.315789 |    8.0 | 0.856993 |             0.5 |
    | 06.01. |    5.0 |                   0.5 |             0.315789 |                   5.0 |            0.315789 |             0.0 |             0.0 |           0.0 |            0.497434 |       1.112205 | 1.112205 |    1.911188 |       0.315789 |      0.497434 |        0.394737 |    5.0 | 1.112205 |             0.5 |
    | 07.01. |    3.0 |                   0.5 |             0.394737 |                   5.0 |            0.394735 |             0.0 |             0.0 |           0.0 |            0.490789 |       1.218885 | 1.218885 |    1.988567 |       0.394735 |      0.490789 |        0.473684 |    3.0 | 1.218885 |             0.5 |
    | 08.01. |    2.0 |                   0.5 |             0.473684 |                   5.0 |            0.473676 |             0.0 |             0.0 |           0.0 |            0.470723 |       1.237798 | 1.237798 |    1.972825 |       0.473676 |      0.470723 |        0.552632 |    2.0 | 1.237798 |             0.5 |
    | 09.01. |    1.0 |                   0.5 |             0.552632 |                   5.0 |            0.552601 |             0.0 |             0.0 |           0.0 |            0.427028 |       1.200864 | 1.200864 |     1.87083 |       0.552601 |      0.427028 |        0.631579 |    1.0 | 1.200864 |             0.5 |
    | 10.01. |    0.0 |                   0.5 |             0.631579 |                   5.0 |            0.631463 |             0.0 |             0.0 |           0.0 |            0.362181 |       1.111921 | 1.111921 |     1.68891 |       0.631463 |      0.362181 |        0.710526 |    0.0 | 1.111921 |             0.5 |
    | 11.01. |    0.0 |                   0.5 |             0.710526 |                   5.0 |            0.710086 |             0.0 |             0.0 |           0.0 |            0.286864 |       1.001148 | 1.001148 |    1.516274 |       0.710086 |      0.286864 |        0.789474 |    0.0 | 1.001148 |             0.5 |
    | 12.01. |    0.0 |                   0.5 |             0.789474 |                   5.0 |            0.787817 |             0.0 |             0.0 |           0.0 |            0.208657 |       0.896124 | 0.896124 |    1.352753 |       0.787817 |      0.208657 |        0.868421 |    0.0 | 0.896124 |             0.5 |
    | 13.01. |    0.0 |                   0.5 |             0.868421 |                   5.0 |            0.862356 |             0.0 |             0.0 |           0.0 |            0.129881 |       0.796746 | 0.796746 |    1.198185 |       0.862356 |      0.129881 |        0.947368 |    0.0 | 0.796746 |             0.5 |
    | 14.01. |    0.0 |                   0.5 |             0.947368 |                   5.0 |            0.927029 |             0.0 |             0.0 |           0.0 |            0.051045 |       0.703078 | 0.703078 |    1.052934 |       0.927029 |      0.051045 |        1.026316 |    0.0 | 0.703078 |             0.5 |
    | 15.01. |    0.0 |                   0.5 |             1.026316 |                   5.0 |            0.970723 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.614897 | 0.614897 |    0.915936 |       0.970723 |           0.0 |        1.105263 |    0.0 | 0.614897 |             0.5 |
    | 16.01. |    0.0 |                   0.5 |             1.105263 |                   5.0 |            0.990741 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.531013 | 0.531013 |    0.784457 |       0.990741 |           0.0 |        1.184211 |    0.0 | 0.531013 |             0.5 |
    | 17.01. |    0.0 |                   0.5 |             1.184211 |                   5.0 |            0.996746 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.450858 | 0.450858 |    0.659384 |       0.996746 |           0.0 |        1.263158 |    0.0 | 0.450858 |             0.5 |
    | 18.01. |    0.0 |                   0.5 |             1.263158 |                   5.0 |            0.997993 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.374727 | 0.374727 |    0.540781 |       0.997993 |           0.0 |        1.342105 |    0.0 | 0.374727 |             0.5 |
    | 19.01. |    0.0 |                   0.5 |             1.342105 |                   5.0 |            0.998268 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.302558 | 0.302558 |    0.428389 |       0.998268 |           0.0 |        1.421053 |    0.0 | 0.302558 |             0.5 |
    | 20.01. |    0.0 |                   0.5 |             1.421053 |                   5.0 |            0.998337 |             0.0 |             0.0 |           0.0 |                 0.0 |       0.234174 | 0.234174 |      0.3219 |       0.998337 |           0.0 |             1.5 |    0.0 | 0.234174 |             0.5 |

    .. raw:: html

        <iframe
            src="dam_v004_ex13_1.html"
            width="100%"
            height="330px"
            frameborder=0
        ></iframe>
"""

# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.auxs.anntools import ann
# ...from dam
from hydpy.models.dam import dam_model
from hydpy.models.dam import dam_control
from hydpy.models.dam import dam_derived
from hydpy.models.dam import dam_solver
from hydpy.models.dam import dam_fluxes
from hydpy.models.dam import dam_states
from hydpy.models.dam import dam_logs
from hydpy.models.dam import dam_aides
from hydpy.models.dam import dam_inlets
from hydpy.models.dam import dam_outlets
from hydpy.models.dam import dam_receivers


class Model(modeltools.ModelELS):
    """Version 4 of HydPy-Dam."""

    _INLET_METHODS = (dam_model.pic_inflow_v1,
                      dam_model.calc_requiredremoterelease_v2,
                      dam_model.calc_allowedremoterelieve_v1,
                      dam_model.calc_requiredrelease_v2,
                      dam_model.calc_targetedrelease_v1)
    _RECEIVER_METHODS = (dam_model.pic_loggedrequiredremoterelease_v2,
                         dam_model.pic_loggedallowedremoterelieve_v1)
    _PART_ODE_METHODS = (dam_model.pic_inflow_v1,
                         dam_model.calc_waterlevel_v1,
                         dam_model.calc_actualrelease_v1,
                         dam_model.calc_possibleremoterelieve_v1,
                         dam_model.calc_actualremoterelieve_v1,
                         dam_model.calc_actualremoterelease_v1,
                         dam_model.update_actualremoterelease_v1,
                         dam_model.update_actualremoterelieve_v1,
                         dam_model.calc_flooddischarge_v1,
                         dam_model.calc_outflow_v1)
    _FULL_ODE_METHODS = (dam_model.update_watervolume_v3,)
    _OUTLET_METHODS = (dam_model.pass_outflow_v1,
                       dam_model.pass_actualremoterelease_v1,
                       dam_model.pass_actualremoterelieve_v1)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-Dam, Version 4."""
    _PARCLASSES = (dam_control.CatchmentArea,
                   dam_control.WaterLevel2PossibleRemoteRelieve,
                   dam_control.RemoteRelieveTolerance,
                   dam_control.NearDischargeMinimumThreshold,
                   dam_control.NearDischargeMinimumTolerance,
                   dam_control.RestrictTargetedRelease,
                   dam_control.WaterLevelMinimumThreshold,
                   dam_control.WaterLevelMinimumTolerance,
                   dam_control.WaterLevelMinimumRemoteThreshold,
                   dam_control.WaterLevelMinimumRemoteTolerance,
                   dam_control.HighestRemoteDischarge,
                   dam_control.HighestRemoteTolerance,
                   dam_control.WaterVolume2WaterLevel,
                   dam_control.WaterLevel2FloodDischarge)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-Dam, Version 4."""
    _PARCLASSES = (dam_derived.TOY,
                   dam_derived.Seconds,
                   dam_derived.NearDischargeMinimumSmoothPar1,
                   dam_derived.WaterLevelMinimumSmoothPar,
                   dam_derived.WaterLevelMinimumRemoteSmoothPar,
                   dam_derived.HighestRemoteSmoothPar)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of HydPy-Dam, Version 4."""
    _PARCLASSES = (dam_solver.AbsErrorMax,
                   dam_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_fluxes.Inflow,
                   dam_fluxes.RequiredRemoteRelease,
                   dam_fluxes.AllowedRemoteRelieve,
                   dam_fluxes.PossibleRemoteRelieve,
                   dam_fluxes.ActualRemoteRelieve,
                   dam_fluxes.RequiredRelease,
                   dam_fluxes.TargetedRelease,
                   dam_fluxes.ActualRelease,
                   dam_fluxes.ActualRemoteRelease,
                   dam_fluxes.FloodDischarge,
                   dam_fluxes.Outflow)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_states.WaterVolume,)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_logs.LoggedRequiredRemoteRelease,
                   dam_logs.LoggedAllowedRemoteRelieve)


class AideSequences(sequencetools.AideSequences):
    """State sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_aides.WaterLevel,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_outlets.Q,
                   dam_outlets.S,
                   dam_outlets.R)


class ReceiverSequences(sequencetools.LinkSequences):
    """Information link sequences of HydPy-Dam, Version 4."""
    _SEQCLASSES = (dam_receivers.S,
                   dam_receivers.R)


autodoc_applicationmodel()


# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam_v005.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""Version 5 application model of HydPy-Dam.

Application model |dam_v005| is an extension of application model
|dam_v001|.  It provides two additional functionalities.

Just like |dam_v001|, |dam_v005| tries to increase the discharge at
a remote location in the channel downsstream during low flow conditions.
And just like |dam_v001|, |dam_v005| might sometimes fail in doing so
due to limited storage content.  One additional feature of |dam_v005| is
that it passes the information on its own failure to another remote
location.  This can e.g. enable another dam model to jump in whenever
necessary.

The second additional feature of |dam_v005| is that it receives input
from two additional nodes, one for `supply discharge` and the other one
for `relieve discharge`.  `Supply discharge` is understood as water that
is delivered from a remote location in order to increase the storage
content of |dam_v005| when necessary (during droughts). `Relieve discharge`
is understood as water that is discharged from another location in order
to relieve the other location (possibly another dam) during floods.
|dam_v005| calculates both the desirable `supply discharge` and the
acceptable `relieve discharge` and passes that information to one single
or to two separate remote locations.

Integration examples:

    The following integration examples build upon some of the examples
    performed to demonstrate the functionality of model |dam_v001|.
    To achieve comparability, identical parameter values, initial
    conditions, and input values are set.  The following explanations
    focus on the differences between applications models |dam_v005| and
    |dam_v001| mainly.  It seems advisable to start with reading
    the documentation on application model |dam_v001|.

    The time settings are identical:

    >>> from hydpy import pub, Timegrid, Timegrids
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '21.01.2000',
    ...                                    '1d'))

    Due to the high complexity of |dam_v005| and due to the test setting
    of |dam_v001| involving another type of model (|arma_v1|), lots of
    nodes are required (a picture would be helpful):

    >>> from hydpy import Node
    >>> dam_inflow = Node('actual_inflow', variable='Q')
    >>> dam_outflow = Node('dam_outflow', variable='Q')
    >>> tributary_inflow = Node('tributary_inflow', variable='Q')
    >>> tributary_mouth = Node('tributary_mouth', variable='Q')
    >>> actual_supply = Node('actual_supply', variable='S')
    >>> required_supply = Node('required_supply', variable='S')
    >>> allowed_relieve = Node('allowed_relieve', variable='R')
    >>> actual_relieve = Node('actual_relieve', variable='R')
    >>> remote_failure = Node('remote_failure', variable='D')
    >>> from hydpy import Element
    >>> dam = Element(
    ...     'dam',
    ...     inlets=(dam_inflow, actual_supply, actual_relieve),
    ...     outlets=dam_outflow,
    ...     receivers=tributary_mouth,
    ...     senders=(remote_failure, required_supply, allowed_relieve))
    >>> stream1 = Element('stream1',
    ...                    inlets=dam_outflow,
    ...                    outlets=tributary_mouth)
    >>> stream2 = Element('stream2',
    ...                   inlets=tributary_inflow,
    ...                   outlets=tributary_mouth)

    The nodes `dam_inflow` and `dam_outflow` handle the "normal" discharge
    (variable `Q`) into and out of the dam.  Node `dam_outflow` passes its
    discharge values to the routing element `stream1`.  To simulate a
    natural tributary, the second routing element `stream2` is defined,
    which receives its inflow form node `tributary_inflow`.  Both routing
    elements pass their outflow to node `tributary_mouth`. So far, this is
    the setting as the one of the examples on |dam_v001| (but with different
    names).  In addition, |dam_v005| expects two input nodes handling the
    actual supply and relieve discharge values from remote locations
    (node `actual_supply` and node `actual_relieve`) and three sender nodes
    for informing other models (which are not modelled explicitly in the
    following examples) of its required supply and allowed relieve (node
    `required_supply` and node `allowed_relieve`) and its own expected
    failure in increasing low discharge values downstream (`remote_failure`).
    Note that the defined node variable is `S` for both "supply nodes",
    `R` for both "relieve nodes" and `D` for node `remote_failure`
    (`D` stands for "demand" in this context).  These variables are of
    vital importance, as |dam_v005| needs them for realizing the specific
    funcionality of each node.

    :ref:`Recalculation of example 7 <dam_v001_ex07>`

    In the following, all settings of the |dam_v005| model and both
    |arma_v1| models that allow an exact reproduction of example 7
    of the documentation on application model |dam_v001|:

    >>> from hydpy import prepare_model
    >>> from hydpy.models import arma_v1
    >>> arma_model = prepare_model(arma_v1)
    >>> stream2.connect(arma_model)
    >>> arma_model.parameters.control.responses(((), (1.0,)))
    >>> arma_model.parameters.update()
    >>> arma_model = prepare_model(arma_v1)
    >>> stream1.connect(arma_model)
    >>> arma_model.parameters.control.responses(((), (0.2, 0.4, 0.3, 0.1)))
    >>> arma_model.parameters.update()
    >>> arma_model.sequences.logs.login = 0.0
    >>> from hydpy.models.dam_v005 import *
    >>> parameterstep('1d')
    >>> dam.connect(model)
    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 370
    >>> IntegrationTest.plotting_options.activated=(
    ...     fluxes.inflow, fluxes.outflow)
    >>> test = IntegrationTest(
    ...     dam,
    ...     inits=((states.watervolume, 0.0),
    ...            (logs.loggedtotalremotedischarge, 1.9),
    ...            (logs.loggedoutflow, 0.0),
    ...            (stream1.model.sequences.logs.login, 0.0)))
    >>> test.dateformat = '%d.%m.'
    >>> watervolume2waterlevel(
    ...         weights_input=1e-6, weights_output=1e6,
    ...         intercepts_hidden=0.0, intercepts_output=-1e6/2)
    >>> waterlevel2flooddischarge(ann(
    ...        weights_input=0.0, weights_output=0.0,
    ...        intercepts_hidden=0.0, intercepts_output=0.0))
    >>> catchmentarea(86.4)
    >>> nmblogentries(1)
    >>> remotedischargeminimum(1.4)
    >>> remotedischargesafety(0.5)
    >>> neardischargeminimumthreshold(0.2)
    >>> neardischargeminimumtolerance(0.2)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> restricttargetedrelease(True)
    >>> tributary_inflow.sequences.sim.series = [
    ...         1.8, 1.7, 1.6, 1.5, 1.4, 1.3, 1.2, 1.1, 1.0, 1.0,
    ...         1.0, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]
    >>> dam_inflow.sequences.sim.series = 1.0/3.0
    >>> actual_supply.sequences.sim.series = 1.0/3.0
    >>> actual_relieve.sequences.sim.series = 1.0/3.0

    Note the the last three commands above, defining  the three input
    series.  In the example of |dam_v001|, the dam model receives an
    constant inflow of 1 m³/s from a single node.  In this example,
    the dam model receives the same sum of inflow via three separate
    pathways.  This is thought to prove that all node connections are
    actually working.

    Application model |dam_v005| implements six additional control
    parameters, three for calculating the required supply and three
    for calculating the allowed relieve:

    >>> highestremotesupply(1.0)
    >>> waterlevelsupplythreshold(0.2)
    >>> waterlevelsupplytolerance(0.05)
    >>> highestremoterelieve(5.0)
    >>> waterlevelrelievethreshold(0.5)
    >>> waterlevelrelievetolerance(0.05)
    >>> parameters.update()

    First of all, the following test calculation results in the exact
    same outflow values as simulated in the corresponding integration
    example of |dam_v001|.  Secondly, the following table and figure
    contains results specific to |dam_v005|, with |RequiredRemoteRelease|
    being the most interesting case.  At the beginning of the simulation
    period, its value is 1 m³/s, which is the value of |HighestRemoteSupply|.
    When |WaterLevel| reaches the value of parameter
    |WaterLevelRelieveThreshold|, |RequiredRemoteRelease| decreases and
    reaches finally 0 m³/s.  Note that this decrease happens rather
    smoothly around the threshold |WaterLevel| of 0.2 m (which corresponds
    to a |WaterVolume| of 0.8 million m³), due to the smoothing parameter
    |WaterLevelSupplyTolerance| being set to a relatively large value:

    >>> test('dam_v005_ex7')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | allowedremoterelieve | requiredremotesupply | requiredrelease | targetedrelease | actualrelease | missingremoterelease | flooddischarge |  outflow | watervolume | actual_inflow | actual_relieve | actual_supply | allowed_relieve | dam_outflow | remote_failure | required_supply | tributary_inflow | tributary_mouth |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.840351 |                    1.9 |          0.0 |          -0.5 |                 0.005 |                  5.0 |                  1.0 |        0.210526 |        0.210526 |      0.201754 |                  0.0 |            0.0 | 0.201754 |    0.068968 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.201754 |            0.0 |             1.0 |              1.8 |        1.840351 |
    | 02.01. |    1.0 |             1.822886 |               1.638597 |          0.0 |     -0.440351 |              0.008588 |                  5.0 |                  1.0 |         0.21092 |         0.21092 |       0.21092 |                  0.0 |            0.0 |  0.21092 |    0.137145 |      0.333333 |       0.333333 |      0.333333 |             5.0 |     0.21092 |            0.0 |             1.0 |              1.7 |        1.822886 |
    | 03.01. |    1.0 |             1.787111 |               1.611966 |          0.0 |     -0.422886 |              0.010053 |                  5.0 |             0.999999 |        0.211084 |        0.211084 |      0.211084 |                  0.0 |            0.0 | 0.211084 |    0.205307 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.211084 |            0.0 |        0.999999 |              1.6 |        1.787111 |
    | 04.01. |    1.0 |              1.71019 |               1.576027 |          0.0 |     -0.387111 |              0.013858 |                  5.0 |             0.999994 |        0.211523 |        0.211523 |      0.211523 |                  0.0 |            0.0 | 0.211523 |    0.273432 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.211523 |            0.0 |        0.999994 |              1.5 |         1.71019 |
    | 05.01. |    1.0 |             1.611668 |               1.498667 |          0.0 |      -0.31019 |              0.027322 |                  5.0 |             0.999973 |        0.213209 |        0.213209 |      0.213209 |                  0.0 |            0.0 | 0.213209 |     0.34141 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.213209 |            0.0 |        0.999973 |              1.4 |        1.611668 |
    | 06.01. |    1.0 |             1.513658 |               1.398459 |     0.001541 |     -0.211668 |              0.064075 |                  5.0 |             0.999875 |        0.219043 |        0.219043 |      0.219043 |                  0.0 |            0.0 | 0.219043 |    0.408885 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.219043 |            0.0 |        0.999875 |              1.3 |        1.513658 |
    | 07.01. |    1.0 |             1.429416 |               1.294615 |     0.105385 |     -0.113658 |              0.235523 |                  5.0 |             0.999481 |        0.283419 |        0.283419 |      0.283419 |                  0.0 |            0.0 | 0.283419 |    0.470798 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.283419 |            0.0 |        0.999481 |              1.2 |        1.429416 |
    | 08.01. |    1.0 |             1.395444 |               1.145997 |     0.254003 |     -0.029416 |              0.470414 |                  5.0 |             0.998531 |        0.475212 |        0.475212 |      0.475212 |                  0.0 |            0.0 | 0.475212 |    0.516139 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.475212 |            0.0 |        0.998531 |              1.1 |        1.395444 |
    | 09.01. |    1.0 |             1.444071 |               0.920232 |     0.479768 |      0.004556 |              0.735001 |                  5.0 |             0.997518 |        0.735281 |        0.735281 |      0.735281 |                  0.0 |            0.0 | 0.735281 |    0.539011 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.735281 |            0.0 |        0.997518 |              1.0 |        1.444071 |
    | 10.01. |    1.0 |             1.643281 |                0.70879 |      0.69121 |     -0.044071 |              0.891263 |                  5.0 |             0.996923 |        0.891315 |        0.891315 |      0.891315 |                  0.0 |            0.0 | 0.891315 |    0.548402 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.891315 |            0.0 |        0.996923 |              1.0 |        1.643281 |
    | 11.01. |    1.0 |             1.763981 |               0.751966 |     0.648034 |     -0.243281 |              0.696325 |                  5.0 |             0.994396 |        0.696749 |        0.696749 |      0.696749 |                  0.0 |            0.0 | 0.696749 |    0.574602 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.696749 |            0.0 |        0.994396 |              1.0 |        1.763981 |
    | 12.01. |    1.0 |             1.692903 |               1.067232 |     0.332768 |     -0.363981 |              0.349797 |                  5.0 |             0.980562 |        0.366406 |        0.366406 |      0.366406 |                  0.0 |            0.0 | 0.366406 |    0.629345 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.366406 |            0.0 |        0.980562 |              1.0 |        1.692903 |
    | 13.01. |    1.0 |             1.590367 |               1.326497 |     0.073503 |     -0.292903 |              0.105231 |                  5.0 |             0.915976 |        0.228241 |        0.228241 |      0.228241 |                  0.0 |            0.0 | 0.228241 |    0.696025 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.228241 |            0.0 |        0.915976 |              1.1 |        1.590367 |
    | 14.01. |    1.0 |             1.516904 |               1.362126 |     0.037874 |     -0.190367 |              0.111928 |                  5.0 |              0.70276 |        0.230054 |        0.230054 |      0.230054 |                  0.0 |            0.0 | 0.230054 |    0.762548 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.230054 |            0.0 |         0.70276 |              1.2 |        1.516904 |
    | 15.01. |    1.0 |             1.554409 |                1.28685 |      0.11315 |     -0.116904 |              0.240436 |                  5.0 |             0.364442 |        0.286374 |        0.286374 |      0.286374 |                  0.0 |            0.0 | 0.286374 |    0.824205 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.286374 |            0.0 |        0.364442 |              1.3 |        1.554409 |
    | 16.01. |    1.0 |             1.662351 |               1.268035 |     0.131965 |     -0.154409 |              0.229369 |                  5.0 |             0.120704 |        0.279807 |        0.279807 |      0.279807 |                  0.0 |            0.0 | 0.279807 |     0.88643 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.279807 |            0.0 |        0.120704 |              1.4 |        1.662351 |
    | 17.01. |    1.0 |             1.764451 |               1.382544 |     0.017456 |     -0.262351 |              0.058622 |                  5.0 |             0.028249 |         0.21805 |         0.21805 |       0.21805 |                  0.0 |            0.0 |  0.21805 |    0.953991 |      0.333333 |       0.333333 |      0.333333 |             5.0 |     0.21805 |            0.0 |        0.028249 |              1.5 |        1.764451 |
    | 18.01. |    1.0 |             1.842178 |                 1.5464 |          0.0 |     -0.364451 |              0.016958 |                  5.0 |             0.006045 |        0.211892 |        0.211892 |      0.211892 |                  0.0 |            0.0 | 0.211892 |    1.022083 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.211892 |            0.0 |        0.006045 |              1.6 |        1.842178 |
    | 19.01. |    1.0 |             1.920334 |               1.630286 |          0.0 |     -0.442178 |              0.008447 |                  5.0 |             0.001268 |        0.210904 |        0.210904 |      0.210904 |                  0.0 |            0.0 | 0.210904 |    1.090261 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.210904 |            0.0 |        0.001268 |              1.7 |        1.920334 |
    | 20.01. |    1.0 |             2.011822 |               1.709429 |          0.0 |     -0.520334 |              0.004155 |                  5.0 |             0.000265 |        0.210435 |        0.210435 |      0.210435 |                  0.0 |            0.0 | 0.210435 |    1.158479 |      0.333333 |       0.333333 |      0.333333 |             5.0 |    0.210435 |            0.0 |        0.000265 |              1.8 |        2.011822 |

    .. raw:: html

        <iframe
            src="dam_v005_ex7.html"
            width="100%"
            height="400px"
            frameborder=0
        ></iframe>

   :ref:`Recalculation of example 8.1 <dam_v001_ex08_1>`

    The next recalculation confirms that the restriction on releasing
    water when there is little inflow works as explained for model
    |dam_v001|.  In addition, it is shown that |MissingRemoteRelease|
    values greater than 0 m³/s result when |ActualRelease| is smaller
    than |RequiredRemoteRelease|:

    >>> dam_inflow.sequences.sim.series[:10] = 1.0
    >>> dam_inflow.sequences.sim.series[10:] = 0.1
    >>> actual_supply.sequences.sim.series = 0.0
    >>> actual_relieve.sequences.sim.series = 0.0
    >>> neardischargeminimumtolerance(0.0)
    >>> test('dam_v005_ex8')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | allowedremoterelieve | requiredremotesupply | requiredrelease | targetedrelease | actualrelease | missingremoterelease | flooddischarge |  outflow | watervolume | actual_inflow | actual_relieve | actual_supply | allowed_relieve | dam_outflow | remote_failure | required_supply | tributary_inflow | tributary_mouth |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    1.0 |             1.838333 |                    1.9 |          0.0 |          -0.5 |                 0.005 |                  5.0 |                  1.0 |             0.2 |             0.2 |      0.191667 |                  0.0 |            0.0 | 0.191667 |     0.06984 |           1.0 |            0.0 |           0.0 |             5.0 |    0.191667 |            0.0 |             1.0 |              1.8 |        1.838333 |
    | 02.01. |    1.0 |             1.816667 |               1.646667 |          0.0 |     -0.438333 |              0.008746 |                  5.0 |                  1.0 |             0.2 |             0.2 |           0.2 |                  0.0 |            0.0 |      0.2 |     0.13896 |           1.0 |            0.0 |           0.0 |             5.0 |         0.2 |            0.0 |             1.0 |              1.7 |        1.816667 |
    | 03.01. |    1.0 |               1.7775 |               1.616667 |          0.0 |     -0.416667 |              0.010632 |                  5.0 |             0.999999 |             0.2 |             0.2 |           0.2 |                  0.0 |            0.0 |      0.2 |     0.20808 |           1.0 |            0.0 |           0.0 |             5.0 |         0.2 |            0.0 |        0.999999 |              1.6 |          1.7775 |
    | 04.01. |    1.0 |             1.699167 |                 1.5775 |          0.0 |       -0.3775 |              0.015099 |                  5.0 |             0.999994 |             0.2 |             0.2 |           0.2 |                  0.0 |            0.0 |      0.2 |      0.2772 |           1.0 |            0.0 |           0.0 |             5.0 |         0.2 |            0.0 |        0.999994 |              1.5 |        1.699167 |
    | 05.01. |    1.0 |                  1.6 |               1.499167 |          0.0 |     -0.299167 |               0.03006 |                  5.0 |              0.99997 |             0.2 |             0.2 |           0.2 |                  0.0 |            0.0 |      0.2 |     0.34632 |           1.0 |            0.0 |           0.0 |             5.0 |         0.2 |            0.0 |         0.99997 |              1.4 |             1.6 |
    | 06.01. |    1.0 |                  1.5 |                    1.4 |          0.0 |          -0.2 |              0.068641 |                  5.0 |             0.999855 |             0.2 |             0.2 |           0.2 |                  0.0 |            0.0 |      0.2 |     0.41544 |           1.0 |            0.0 |           0.0 |             5.0 |         0.2 |            0.0 |        0.999855 |              1.3 |             1.5 |
    | 07.01. |    1.0 |             1.408516 |                    1.3 |          0.1 |          -0.1 |              0.242578 |                  5.0 |             0.999346 |        0.242578 |        0.242578 |      0.242578 |                  0.0 |            0.0 | 0.242578 |    0.480881 |           1.0 |            0.0 |           0.0 |             5.0 |    0.242578 |            0.0 |        0.999346 |              1.2 |        1.408516 |
    | 08.01. |    1.0 |             1.371888 |               1.165937 |     0.234063 |     -0.008516 |              0.474285 |                  5.0 |             0.998146 |        0.474285 |        0.474285 |      0.474285 |                  0.0 |            0.0 | 0.474285 |    0.526303 |           1.0 |            0.0 |           0.0 |             5.0 |    0.474285 |            0.0 |        0.998146 |              1.1 |        1.371888 |
    | 09.01. |    1.0 |              1.43939 |               0.897603 |     0.502397 |      0.028112 |              0.784512 |                  5.0 |             0.997159 |        0.784512 |        0.784512 |      0.784512 |                  0.0 |            0.0 | 0.784512 |    0.544921 |           1.0 |            0.0 |           0.0 |             5.0 |    0.784512 |            0.0 |        0.997159 |              1.0 |         1.43939 |
    | 10.01. |    1.0 |              1.67042 |               0.654878 |     0.745122 |      -0.03939 |               0.95036 |                  5.0 |             0.996865 |         0.95036 |         0.95036 |       0.95036 |                  0.0 |            0.0 |  0.95036 |     0.54921 |           1.0 |            0.0 |           0.0 |             5.0 |     0.95036 |            0.0 |        0.996865 |              1.0 |         1.67042 |
    | 11.01. |    0.1 |             1.682926 |               0.720061 |     0.679939 |      -0.27042 |               0.71839 |                  5.0 |             0.996865 |         0.71839 |             0.1 |           0.1 |              0.61839 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |        0.61839 |        0.996865 |              1.0 |        1.682926 |
    | 12.01. |    0.1 |             1.423559 |               1.582926 |          0.0 |     -0.282926 |              0.034564 |                  5.0 |             0.996865 |             0.2 |             0.1 |           0.1 |                  0.0 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |            0.0 |        0.996865 |              1.0 |        1.423559 |
    | 13.01. |    0.1 |             1.285036 |               1.323559 |     0.076441 |     -0.023559 |              0.299482 |                  5.0 |             0.996865 |        0.299482 |             0.1 |           0.1 |             0.199482 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |       0.199482 |        0.996865 |              1.1 |        1.285036 |
    | 14.01. |    0.1 |                  1.3 |               1.185036 |     0.214964 |      0.114964 |              0.585979 |                  5.0 |             0.996865 |        0.585979 |             0.1 |           0.1 |             0.485979 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |       0.485979 |        0.996865 |              1.2 |             1.3 |
    | 15.01. |    0.1 |                  1.4 |                    1.2 |          0.2 |           0.1 |              0.557422 |                  5.0 |             0.996865 |        0.557422 |             0.1 |           0.1 |             0.457422 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |       0.457422 |        0.996865 |              1.3 |             1.4 |
    | 16.01. |    0.1 |                  1.5 |                    1.3 |          0.1 |          -0.0 |                  0.35 |                  5.0 |             0.996865 |            0.35 |             0.1 |           0.1 |                 0.25 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |           0.25 |        0.996865 |              1.4 |             1.5 |
    | 17.01. |    0.1 |                  1.6 |                    1.4 |          0.0 |          -0.1 |              0.142578 |                  5.0 |             0.996865 |             0.2 |             0.1 |           0.1 |             0.042578 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |       0.042578 |        0.996865 |              1.5 |             1.6 |
    | 18.01. |    0.1 |                  1.7 |                    1.5 |          0.0 |          -0.2 |              0.068641 |                  5.0 |             0.996865 |             0.2 |             0.1 |           0.1 |                  0.0 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |            0.0 |        0.996865 |              1.6 |             1.7 |
    | 19.01. |    0.1 |                  1.8 |                    1.6 |          0.0 |          -0.3 |              0.029844 |                  5.0 |             0.996865 |             0.2 |             0.1 |           0.1 |                  0.0 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |            0.0 |        0.996865 |              1.7 |             1.8 |
    | 20.01. |    0.1 |                  1.9 |                    1.7 |          0.0 |          -0.4 |              0.012348 |                  5.0 |             0.996865 |             0.2 |             0.1 |           0.1 |                  0.0 |            0.0 |      0.1 |     0.54921 |           0.1 |            0.0 |           0.0 |             5.0 |         0.1 |            0.0 |        0.996865 |              1.8 |             1.9 |

    .. raw:: html

        <iframe
            src="dam_v005_ex8.html"
            width="100%"
            height="400px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 10 <dam_v001_ex10>`

    The last recalculation for low flow conditions deals with a case where
    the available water storage is too limited to supply enough discharge.
    Again, there is perfect agreement with the corresponding results
    of |dam_v001|:

    >>> waterlevelminimumtolerance(0.01)
    >>> waterlevelminimumthreshold(0.005)
    >>> dam_inflow.sequences.sim.series = numpy.linspace(0.2, 0.0, 20)
    >>> test('dam_v005_ex10')
    |   date |   inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | allowedremoterelieve | requiredremotesupply | requiredrelease | targetedrelease | actualrelease | missingremoterelease | flooddischarge |  outflow | watervolume | actual_inflow | actual_relieve | actual_supply | allowed_relieve | dam_outflow | remote_failure | required_supply | tributary_inflow | tributary_mouth |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |      0.2 |             1.807702 |                    1.9 |          0.0 |          -0.5 |                 0.005 |                  5.0 |                  1.0 |             0.2 |             0.2 |      0.038512 |                  0.0 |            0.0 | 0.038512 |    0.013953 |           0.2 |            0.0 |           0.0 |             5.0 |    0.038512 |            0.0 |             1.0 |              1.8 |        1.807702 |
    | 02.01. | 0.189474 |             1.732852 |                1.76919 |          0.0 |     -0.407702 |              0.011524 |                  5.0 |                  1.0 |             0.2 |        0.189474 |      0.087238 |                  0.0 |            0.0 | 0.087238 |    0.022786 |      0.189474 |            0.0 |           0.0 |             5.0 |    0.087238 |            0.0 |             1.0 |              1.7 |        1.732852 |
    | 03.01. | 0.178947 |             1.669885 |               1.645614 |          0.0 |     -0.332852 |              0.022415 |                  5.0 |                  1.0 |             0.2 |        0.178947 |      0.117178 |                  0.0 |            0.0 | 0.117178 |    0.028123 |      0.178947 |            0.0 |           0.0 |             5.0 |    0.117178 |            0.0 |             1.0 |              1.6 |        1.669885 |
    | 04.01. | 0.168421 |             1.602505 |               1.552706 |          0.0 |     -0.269885 |              0.038625 |                  5.0 |                  1.0 |             0.2 |        0.168421 |      0.128057 |                  0.0 |            0.0 | 0.128057 |     0.03161 |      0.168421 |            0.0 |           0.0 |             5.0 |    0.128057 |            0.0 |             1.0 |              1.5 |        1.602505 |
    | 05.01. | 0.157895 |             1.520865 |               1.474448 |          0.0 |     -0.202505 |              0.067289 |                  5.0 |                  1.0 |             0.2 |        0.157895 |      0.128824 |                  0.0 |            0.0 | 0.128824 |    0.034122 |      0.157895 |            0.0 |           0.0 |             5.0 |    0.128824 |            0.0 |             1.0 |              1.4 |        1.520865 |
    | 06.01. | 0.147368 |             1.426729 |               1.392041 |     0.007959 |     -0.120865 |              0.131822 |                  5.0 |                  1.0 |             0.2 |        0.147368 |      0.125323 |             0.006499 |            0.0 | 0.125323 |    0.036026 |      0.147368 |            0.0 |           0.0 |             5.0 |    0.125323 |       0.006499 |             1.0 |              1.3 |        1.426729 |
    | 07.01. | 0.136842 |             1.325484 |               1.301406 |     0.098594 |     -0.026729 |              0.318041 |                  5.0 |                  1.0 |        0.318041 |        0.136842 |       0.11951 |             0.198531 |            0.0 |  0.11951 |    0.037524 |      0.136842 |            0.0 |           0.0 |             5.0 |     0.11951 |       0.198531 |             1.0 |              1.2 |        1.325484 |
    | 08.01. | 0.126316 |             1.220753 |               1.205974 |     0.194026 |      0.074516 |              0.526433 |                  5.0 |                  1.0 |        0.526433 |        0.126316 |      0.112348 |             0.414085 |            0.0 | 0.112348 |    0.038731 |      0.126316 |            0.0 |           0.0 |             5.0 |    0.112348 |       0.414085 |             1.0 |              1.1 |        1.220753 |
    | 09.01. | 0.115789 |             1.114193 |               1.108405 |     0.291595 |      0.179247 |               0.71086 |                  5.0 |                  1.0 |         0.71086 |        0.115789 |      0.104345 |             0.606515 |            0.0 | 0.104345 |     0.03972 |      0.115789 |            0.0 |           0.0 |             5.0 |    0.104345 |       0.606515 |             1.0 |              1.0 |        1.114193 |
    | 10.01. | 0.105263 |             1.106551 |               1.009849 |     0.390151 |      0.285807 |              0.856429 |                  5.0 |                  1.0 |        0.856429 |        0.105263 |      0.095788 |             0.760641 |            0.0 | 0.095788 |    0.040538 |      0.105263 |            0.0 |           0.0 |             5.0 |    0.095788 |       0.760641 |             1.0 |              1.0 |        1.106551 |
    | 11.01. | 0.094737 |             1.098224 |               1.010763 |     0.389237 |      0.293449 |              0.857658 |                  5.0 |                  1.0 |        0.857658 |        0.094737 |      0.086852 |             0.770806 |            0.0 | 0.086852 |    0.041219 |      0.094737 |            0.0 |           0.0 |             5.0 |    0.086852 |       0.770806 |             1.0 |              1.0 |        1.098224 |
    | 12.01. | 0.084211 |             1.089441 |               1.011372 |     0.388628 |      0.301776 |              0.859239 |                  5.0 |                  1.0 |        0.859239 |        0.084211 |      0.077648 |             0.781591 |            0.0 | 0.077648 |    0.041786 |      0.084211 |            0.0 |           0.0 |             5.0 |    0.077648 |       0.781591 |             1.0 |              1.0 |        1.089441 |
    | 13.01. | 0.073684 |             1.180343 |               1.011794 |     0.388206 |      0.310559 |              0.860972 |                  5.0 |                  1.0 |        0.860972 |        0.073684 |      0.068248 |             0.792723 |            0.0 | 0.068248 |    0.042256 |      0.073684 |            0.0 |           0.0 |             5.0 |    0.068248 |       0.792723 |             1.0 |              1.1 |        1.180343 |
    | 14.01. | 0.063158 |              1.27102 |               1.112095 |     0.287905 |      0.219657 |              0.729278 |                  5.0 |                  1.0 |        0.729278 |        0.063158 |      0.058705 |             0.670573 |            0.0 | 0.058705 |    0.042641 |      0.063158 |            0.0 |           0.0 |             5.0 |    0.058705 |       0.670573 |             1.0 |              1.2 |         1.27102 |
    | 15.01. | 0.052632 |             1.361533 |               1.212314 |     0.187686 |       0.12898 |               0.57064 |                  5.0 |                  1.0 |         0.57064 |        0.052632 |      0.049056 |             0.521584 |            0.0 | 0.049056 |     0.04295 |      0.052632 |            0.0 |           0.0 |             5.0 |    0.049056 |       0.521584 |             1.0 |              1.3 |        1.361533 |
    | 16.01. | 0.042105 |             1.451924 |               1.312477 |     0.087523 |      0.038467 |              0.381259 |                  5.0 |                  1.0 |        0.381259 |        0.042105 |      0.039328 |             0.341932 |            0.0 | 0.039328 |     0.04319 |      0.042105 |            0.0 |           0.0 |             5.0 |    0.039328 |       0.341932 |             1.0 |              1.4 |        1.451924 |
    | 17.01. | 0.031579 |             1.542227 |               1.412597 |          0.0 |     -0.051924 |              0.191457 |                  5.0 |                  1.0 |             0.2 |        0.031579 |      0.029542 |             0.161915 |            0.0 | 0.029542 |    0.043366 |      0.031579 |            0.0 |           0.0 |             5.0 |    0.029542 |       0.161915 |             1.0 |              1.5 |        1.542227 |
    | 18.01. | 0.021053 |             1.632464 |               1.512685 |          0.0 |     -0.142227 |              0.106486 |                  5.0 |                  1.0 |             0.2 |        0.021053 |      0.019715 |             0.086771 |            0.0 | 0.019715 |    0.043481 |      0.021053 |            0.0 |           0.0 |             5.0 |    0.019715 |       0.086771 |             1.0 |              1.6 |        1.632464 |
    | 19.01. | 0.010526 |             1.722654 |               1.612748 |          0.0 |     -0.232464 |              0.052805 |                  5.0 |                  1.0 |             0.2 |        0.010526 |      0.009864 |             0.042941 |            0.0 | 0.009864 |    0.043539 |      0.010526 |            0.0 |           0.0 |             5.0 |    0.009864 |       0.042941 |             1.0 |              1.7 |        1.722654 |
    | 20.01. |      0.0 |             1.812814 |                1.71279 |          0.0 |     -0.322654 |               0.02451 |                  5.0 |                  1.0 |             0.2 |             0.0 |           0.0 |              0.02451 |            0.0 |      0.0 |    0.043539 |           0.0 |            0.0 |           0.0 |             5.0 |         0.0 |        0.02451 |             1.0 |              1.8 |        1.812814 |

    .. raw:: html

        <iframe
            src="dam_v005_ex10.html"
            width="100%"
            height="400px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 13 <dam_v001_ex13>`

    The final recalculation shows the equality of both application
    models |dam_v001| and |dam_v005| under high flow conditions.
    This example also demonstrates the determination of
    |AllowedRemoteRelieve|, which is functionally similar to the
    determination of |RequiredRemoteSupply| discussed above:

    >>> remotedischargeminimum(0.0)
    >>> remotedischargesafety(0.0)
    >>> neardischargeminimumthreshold(0.0)
    >>> neardischargeminimumtolerance(0.0)
    >>> waterlevelminimumthreshold(0.0)
    >>> waterlevelminimumtolerance(0.0)
    >>> waterlevel2flooddischarge(ann(
    ...         weights_input=1e-6, weights_output=1e7,
    ...         intercepts_hidden=0.0, intercepts_output=-1e7/2))
    >>> neardischargeminimumthreshold(0.0)
    >>> dam_inflow.sequences.sim.series = [
    ...     0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...     0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
    >>> test.inits.loggedtotalremotedischarge = 1.0
    >>> tributary_inflow.sequences.sim.series = 1.0

    >>> test('dam_v005_ex13')
    |   date | inflow | totalremotedischarge | naturalremotedischarge | remotedemand | remotefailure | requiredremoterelease | allowedremoterelieve | requiredremotesupply | requiredrelease | targetedrelease | actualrelease | missingremoterelease | flooddischarge |  outflow | watervolume | actual_inflow | actual_relieve | actual_supply | allowed_relieve | dam_outflow | remote_failure | required_supply | tributary_inflow | tributary_mouth |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |    0.0 |                  1.0 |                    1.0 |          0.0 |          -1.0 |                   0.0 |                  5.0 |                  1.0 |             0.0 |             0.0 |           0.0 |                  0.0 |            0.0 |      0.0 |         0.0 |           0.0 |            0.0 |           0.0 |             5.0 |         0.0 |            0.0 |             1.0 |              1.0 |             1.0 |
    | 02.01. |    1.0 |             1.005303 |                    1.0 |          0.0 |          -1.0 |                   0.0 |                  5.0 |                  1.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.026514 | 0.026514 |    0.084109 |           1.0 |            0.0 |           0.0 |             5.0 |    0.026514 |            0.0 |             1.0 |              1.0 |        1.005303 |
    | 03.01. |    5.0 |             1.047354 |               0.978789 |          0.0 |     -1.005303 |                   0.0 |                  5.0 |             0.998985 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.183744 | 0.183744 |    0.500234 |           5.0 |            0.0 |           0.0 |             5.0 |    0.183744 |            0.0 |        0.998985 |              1.0 |        1.047354 |
    | 04.01. |    9.0 |             1.190048 |                0.86361 |          0.0 |     -1.047354 |                   0.0 |                  5.0 |             0.000051 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.542983 | 0.542983 |     1.23092 |           9.0 |            0.0 |           0.0 |             5.0 |    0.542983 |            0.0 |        0.000051 |              1.0 |        1.190048 |
    | 05.01. |    8.0 |             1.467176 |               0.647066 |          0.0 |     -1.190048 |                   0.0 |             4.879843 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.961039 | 0.961039 |    1.839086 |           8.0 |            0.0 |           0.0 |        4.879843 |    0.961039 |            0.0 |             0.0 |              1.0 |        1.467176 |
    | 06.01. |    5.0 |             1.815989 |               0.506136 |          0.0 |     -1.467176 |                   0.0 |             0.115985 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.251523 | 1.251523 |    2.162955 |           5.0 |            0.0 |           0.0 |        0.115985 |    1.251523 |            0.0 |             0.0 |              1.0 |        1.815989 |
    | 07.01. |    3.0 |             2.122328 |               0.564467 |          0.0 |     -1.815989 |                   0.0 |             0.004898 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.395546 | 1.395546 |    2.301579 |           3.0 |            0.0 |           0.0 |        0.004898 |    1.395546 |            0.0 |             0.0 |              1.0 |        2.122328 |
    | 08.01. |    2.0 |             2.320454 |               0.726783 |          0.0 |     -2.122328 |                   0.0 |             0.001654 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.453375 | 1.453375 |    2.348808 |           2.0 |            0.0 |           0.0 |        0.001654 |    1.453375 |            0.0 |             0.0 |              1.0 |        2.320454 |
    | 09.01. |    1.0 |             2.416285 |               0.867079 |          0.0 |     -2.320454 |                   0.0 |             0.004081 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.455596 | 1.455596 |    2.309444 |           1.0 |            0.0 |           0.0 |        0.004081 |    1.455596 |            0.0 |             0.0 |              1.0 |        2.416285 |
    | 10.01. |    0.0 |             2.438832 |               0.960689 |          0.0 |     -2.416285 |                   0.0 |             0.065514 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.405132 | 1.405132 |    2.188041 |           0.0 |            0.0 |           0.0 |        0.065514 |    1.405132 |            0.0 |             0.0 |              1.0 |        2.438832 |
    | 11.01. |    0.0 |             2.410323 |                 1.0337 |          0.0 |     -2.438832 |                   0.0 |              0.78615 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.331267 | 1.331267 |    2.073019 |           0.0 |            0.0 |           0.0 |         0.78615 |    1.331267 |            0.0 |             0.0 |              1.0 |        2.410323 |
    | 12.01. |    0.0 |             2.351863 |               1.079056 |          0.0 |     -2.410323 |                   0.0 |             3.476325 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.261285 | 1.261285 |    1.964044 |           0.0 |            0.0 |           0.0 |        3.476325 |    1.261285 |            0.0 |             0.0 |              1.0 |        2.351863 |
    | 13.01. |    0.0 |             2.283403 |               1.090578 |          0.0 |     -2.351863 |                   0.0 |             4.803618 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.194981 | 1.194981 |    1.860798 |           0.0 |            0.0 |           0.0 |        4.803618 |    1.194981 |            0.0 |             0.0 |              1.0 |        2.283403 |
    | 14.01. |    0.0 |             2.215937 |               1.088422 |          0.0 |     -2.283403 |                   0.0 |             4.978494 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.132163 | 1.132163 |    1.762979 |           0.0 |            0.0 |           0.0 |        4.978494 |    1.132163 |            0.0 |             0.0 |              1.0 |        2.215937 |
    | 15.01. |    0.0 |             2.152017 |               1.083774 |          0.0 |     -2.215937 |                   0.0 |             4.997433 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       1.072647 | 1.072647 |    1.670302 |           0.0 |            0.0 |           0.0 |        4.997433 |    1.072647 |            0.0 |             0.0 |              1.0 |        2.152017 |
    | 16.01. |    0.0 |             2.091458 |                1.07937 |          0.0 |     -2.152017 |                   0.0 |             4.999658 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |        1.01626 |  1.01626 |    1.582498 |           0.0 |            0.0 |           0.0 |        4.999658 |     1.01626 |            0.0 |             0.0 |              1.0 |        2.091458 |
    | 17.01. |    0.0 |             2.034082 |               1.075198 |          0.0 |     -2.091458 |                   0.0 |             4.999949 |                  0.0 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.962837 | 0.962837 |    1.499308 |           0.0 |            0.0 |           0.0 |        4.999949 |    0.962837 |            0.0 |             0.0 |              1.0 |        2.034082 |
    | 18.01. |    0.0 |             1.979722 |               1.071245 |          0.0 |     -2.034082 |                   0.0 |             4.999992 |             0.000001 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.912222 | 0.912222 |    1.420492 |           0.0 |            0.0 |           0.0 |        4.999992 |    0.912222 |            0.0 |        0.000001 |              1.0 |        1.979722 |
    | 19.01. |    0.0 |              1.92822 |                 1.0675 |          0.0 |     -1.979722 |                   0.0 |             4.999999 |             0.000004 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.864268 | 0.864268 |     1.34582 |           0.0 |            0.0 |           0.0 |        4.999999 |    0.864268 |            0.0 |        0.000004 |              1.0 |         1.92822 |
    | 20.01. |    0.0 |             1.879425 |               1.063951 |          0.0 |      -1.92822 |                   0.0 |                  5.0 |             0.000018 |             0.0 |             0.0 |           0.0 |                  0.0 |       0.818835 | 0.818835 |    1.275072 |           0.0 |            0.0 |           0.0 |             5.0 |    0.818835 |            0.0 |        0.000018 |              1.0 |        1.879425 |

    .. raw:: html

        <iframe
            src="dam_v005_ex13.html"
            width="100%"
            height="400px"
            frameborder=0
        ></iframe>
"""
# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.auxs.anntools import ann
# ...from dam
from hydpy.models.dam import dam_model
from hydpy.models.dam import dam_control
from hydpy.models.dam import dam_derived
from hydpy.models.dam import dam_solver
from hydpy.models.dam import dam_fluxes
from hydpy.models.dam import dam_states
from hydpy.models.dam import dam_logs
from hydpy.models.dam import dam_aides
from hydpy.models.dam import dam_inlets
from hydpy.models.dam import dam_outlets
from hydpy.models.dam import dam_receivers
from hydpy.models.dam import dam_senders


class Model(modeltools.ModelELS):
    """Version 5 of HydPy-Dam."""

    _INLET_METHODS = (dam_model.pic_inflow_v2,
                      dam_model.calc_naturalremotedischarge_v1,
                      dam_model.calc_remotedemand_v1,
                      dam_model.calc_remotefailure_v1,
                      dam_model.calc_requiredremoterelease_v1,
                      dam_model.calc_requiredrelease_v1,
                      dam_model.calc_targetedrelease_v1)
    _RECEIVER_METHODS = (dam_model.pic_totalremotedischarge_v1,
                         dam_model.update_loggedtotalremotedischarge_v1)
    _PART_ODE_METHODS = (dam_model.pic_inflow_v2,
                         dam_model.calc_waterlevel_v1,
                         dam_model.calc_actualrelease_v1,
                         dam_model.calc_flooddischarge_v1,
                         dam_model.calc_outflow_v1)
    _FULL_ODE_METHODS = (dam_model.update_watervolume_v1,)
    _OUTLET_METHODS = (dam_model.pass_outflow_v1,
                       dam_model.update_loggedoutflow_v1)
    _SENDER_METHODS = (dam_model.calc_missingremoterelease_v1,
                       dam_model.pass_missingremoterelease_v1,
                       dam_model.calc_allowedremoterelieve_v2,
                       dam_model.pass_allowedremoterelieve_v1,
                       dam_model.calc_requiredremotesupply_v1,
                       dam_model.pass_requiredremotesupply_v1)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-Dam, Version 5."""
    _PARCLASSES = (dam_control.CatchmentArea,
                   dam_control.NmbLogEntries,
                   dam_control.RemoteDischargeMinimum,
                   dam_control.RemoteDischargeSafety,
                   dam_control.NearDischargeMinimumThreshold,
                   dam_control.NearDischargeMinimumTolerance,
                   dam_control.RestrictTargetedRelease,
                   dam_control.WaterLevelMinimumThreshold,
                   dam_control.WaterLevelMinimumTolerance,
                   dam_control.HighestRemoteRelieve,
                   dam_control.WaterLevelRelieveThreshold,
                   dam_control.WaterLevelRelieveTolerance,
                   dam_control.HighestRemoteSupply,
                   dam_control.WaterLevelSupplyThreshold,
                   dam_control.WaterLevelSupplyTolerance,
                   dam_control.WaterVolume2WaterLevel,
                   dam_control.WaterLevel2FloodDischarge)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-Dam, Version 5."""
    _PARCLASSES = (dam_derived.TOY,
                   dam_derived.Seconds,
                   dam_derived.RemoteDischargeSmoothPar,
                   dam_derived.NearDischargeMinimumSmoothPar1,
                   dam_derived.NearDischargeMinimumSmoothPar2,
                   dam_derived.WaterLevelMinimumSmoothPar,
                   dam_derived.WaterLevelRelieveSmoothPar,
                   dam_derived.WaterLevelSupplySmoothPar)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of HydPy-Dam, Version 5."""
    _PARCLASSES = (dam_solver.AbsErrorMax,
                   dam_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_fluxes.Inflow,
                   dam_fluxes.TotalRemoteDischarge,
                   dam_fluxes.NaturalRemoteDischarge,
                   dam_fluxes.RemoteDemand,
                   dam_fluxes.RemoteFailure,
                   dam_fluxes.RequiredRemoteRelease,
                   dam_fluxes.AllowedRemoteRelieve,
                   dam_fluxes.RequiredRemoteSupply,
                   dam_fluxes.RequiredRelease,
                   dam_fluxes.TargetedRelease,
                   dam_fluxes.ActualRelease,
                   dam_fluxes.MissingRemoteRelease,
                   dam_fluxes.FloodDischarge,
                   dam_fluxes.Outflow)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_states.WaterVolume,)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_logs.LoggedTotalRemoteDischarge,
                   dam_logs.LoggedOutflow)


class AideSequences(sequencetools.AideSequences):
    """State sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_aides.WaterLevel,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_inlets.Q,
                   dam_inlets.S,
                   dam_inlets.R)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_outlets.Q,)


class ReceiverSequences(sequencetools.LinkSequences):
    """Information link sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_receivers.Q,)


class SenderSequences(sequencetools.LinkSequences):
    """Information link sequences of HydPy-Dam, Version 5."""
    _SEQCLASSES = (dam_senders.D,
                   dam_senders.S,
                   dam_senders.R)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import

# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from hbranch
from hydpy.models.hbranch import hbranch_model
from hydpy.models.hbranch import hbranch_control
from hydpy.models.hbranch import hbranch_derived
from hydpy.models.hbranch import hbranch_fluxes
from hydpy.models.hbranch import hbranch_inlets
from hydpy.models.hbranch import hbranch_outlets


class Model(hbranch_model.Model):
    """The HBV96 version of HydPy-H-Stream (hbranch_v1)."""
    _INLET_METHODS = (hbranch_model.pick_input_v1,)
    _RUN_METHODS = (hbranch_model.calc_outputs_v1,)
    _OUTLET_METHODS = (hbranch_model.pass_outputs_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of hbranch_v1, directly defined by the user."""
    _PARCLASSES = (hbranch_control.XPoints,
                   hbranch_control.YPoints)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of hbranch_v1, indirectly defined by the user."""
    _PARCLASSES = (hbranch_derived.NmbBranches,
                   hbranch_derived.NmbPoints)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of hbranch_v1."""
    _SEQCLASSES = (hbranch_fluxes.Input,
                   hbranch_fluxes.Outputs)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of hbranch_v1."""
    _SEQCLASSES = (hbranch_inlets.Total,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of hbranch_v1."""
    _SEQCLASSES = (hbranch_outlets.Branched,)


autodoc_applicationmodel()

tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""
Version 1 of the H-Land model is designed to agree with the HBV96
configuration of the HBV model used by the German Federal Institute
of Hydrology (BfG) but offers more flexibility in some regards (e.g. in
parameterization).  It can briefly be summarized as follows:

 * Calculates the *actual* potential evapotranspiration from *reference*
   potential evaporation values.
 * Applies separate correction factors on the liquid and the frozen
   amount of precipitation.
 * Implements interception with simple "buckets".
 * Uses the degree-day method for calculating snowmelt.
 * Considers both the melting of ice and the (re)freezing of water
   within the snow layer.
 * Assumes a linear relationship between soil evaporation and relative soil
   moisture (as long as a maximum evaporation value is not exceeded).
 * Assumes a saturation excess mechanism for the generation of direct runoff.
 * Provides an optional "response area" option, which modifies the usual
   calculation of direct runoff and percolation.
 * Distinguishes between an upper zone layer related to direct runoff and a
   lower zone layer related to base flow.
 * Allows for percolation from the upper to the lower zone layer and allows
   for a capillary rise from upper zone layer to the soils layer.
 * Considers water areas as "groundwater lakes" being connected with
   the lower zone layer.
 * In contrast to the original HBV96 implementation, both the upper and
   the lower zone layer can be handled as nonlinear storages.
 * Conceptualizes the melting of glacial ice with an additional application
   of the degree-day method.

The following figure shows the general structure of H-Land Version 1.
Note that zones of type |FIELD| and |FOREST| are based on the same set of
process equations:

.. image:: HydPy-H-Land_Version-1.png

Integration tests:

    The following integration tests are based on the data used for testing
    application model |lland_v2|.  Hopefully, this eases drawing comparisons
    between both models.

    All integration tests are performed over a period of five days with
    a simulation step of one hour:

    >>> from hydpy import pub, Timegrid, Timegrids
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '05.01.2000',
    ...                                    '1h'))

    Prepare the model instance and build the connections to element `land`
    and node `outlet`:

    >>> from hydpy.models.hland_v1 import *
    >>> parameterstep('1h')
    >>> from hydpy import Node, Element
    >>> outlet = Node('outlet')
    >>> land = Element('land', outlets=outlet)
    >>> land.connect(model)

    All tests shall be performed using a single zone with a size of one
    square kilometre at an altitude of 100 meter:

    >>> nmbzones(1)
    >>> area(1.0)
    >>> zonearea(1.0)
    >>> zonez(1.0)

    The reference elevation levels for precipitation (|ZRelP|), temperature
    (|ZRelT|), and evaporation (|ZRelE|) are all set to 200 m:

    >>> zrelp(2.0)
    >>> zrelt(2.0)
    >>> zrele(2.0)

    Initialize a test function object, which prepares and runs the tests
    and prints their results for the given sequences:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 900
    >>> IntegrationTest.plotting_options.activated=(
    ...     inputs.p, inputs.t, fluxes.qt)
    >>> test = IntegrationTest(land)
    >>> test.dateformat = '%d.%m. %H:00'

    .. _hland_v1_ex1:

    **Example 1**

    In the first example, |FIELD| is selected as the only zone type
    (note that the results for type |FOREST| would be the same):

    >>> zonetype(FIELD)

    The following set of control parameter values tries to configure
    application model |hland_v1| in a manner that allows to retrace
    the influence of the different implemented methods on the shown
    results:

    >>> pcorr(1.2)
    >>> pcalt(0.1)
    >>> rfcf(1.1)
    >>> sfcf(1.3)
    >>> tcalt(0.6)
    >>> ecorr(0.8)
    >>> ecalt(-0.1)
    >>> epf(0.1)
    >>> etf(0.1)
    >>> ered(0.5)
    >>> icmax(2.0)
    >>> tt(0.0)
    >>> ttint(2.0)
    >>> dttm(1.0)
    >>> cfmax(0.5)
    >>> gmelt(1.0)
    >>> cfr(0.1)
    >>> whc(0.4)
    >>> fc(200.0)
    >>> lp(0.8)
    >>> beta(2.0)
    >>> percmax(0.5)
    >>> cflux(0.1)
    >>> alpha(2.0)
    >>> k(0.001)
    >>> k4(0.005)
    >>> gamma(0.0)
    >>> maxbaz(3)
    >>> abstr(0.01)
    >>> parameters.update()

    Initially, relative soil moisture is 50 % and the lower zone layer
    contains only 10 mm.  All other storages are empty:

    >>> test.inits = ((states.ic, 0.0),
    ...               (states.sp, 0.0),
    ...               (states.wc, 0.0),
    ...               (states.sm, 100.0),
    ...               (states.uz, 0.0),
    ...               (states.lz, 10.0),
    ...               (logs.quh, 0.05))

    As mentioned above, the values of the input sequences |P|, |T|, and
    |EPN| are taken from :ref:`here <lland_v2_ex1>`.  For educational
    purposes, unrealistically high values of |EPN| are used again.  For
    the sake of simplicity, the values of |TN| are assumed to be
    constantly 1 °C below the values of |T|:

    >>> inputs.p.series = (
    ...     0.0, 0.0,  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 0.2, 0.0, 0.0, 1.3, 5.6, 2.9, 4.9, 10.6, 0.1, 0.7, 3.0,
    ...     2.1, 10.4, 3.5, 3.4, 1.2, 0.1, 0.0, 0.0, 0.4, 0.1, 3.6, 5.9, 1.1,
    ...     20.7, 37.9, 8.2, 3.6, 7.5, 18.5, 15.4, 6.3, 1.9, 4.9, 2.7, 0.5,
    ...     0.2, 0.5, 2.4, 0.4, 0.2, 0.0, 0.0, 0.3, 2.6, 0.7, 0.3, 0.3, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.3, 0.0,
    ...     0.0, 0.0, 0.7, 0.4, 0.1, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    >>> inputs.t.series = (
    ...     21.2, 19.4, 18.9, 18.3, 18.9, 22.5, 25.1, 28.3, 27.8, 31.4, 32.2,
    ...     35.2, 37.1, 31.2, 24.3, 25.4, 25.9, 23.7, 21.6, 21.2, 20.4, 19.8,
    ...     19.6, 19.2, 19.2, 19.2, 18.9, 18.7, 18.5, 18.3, 18.5, 18.8, 18.8,
    ...     19.0, 19.2, 19.3, 19.0, 18.8, 18.7, 17.8, 17.4, 17.3, 16.8, 16.5,
    ...     16.3, 16.2, 15.5, 14.6, 14.7, 14.6, 14.1, 14.3, 14.9, 15.7, 16.0,
    ...     16.7, 17.1, 16.2, 15.9, 16.3, 16.3, 16.4, 16.5, 18.4, 18.3, 18.1,
    ...     16.7, 15.2, 13.4, 12.4, 11.6, 11.0, 10.5, 11.7, 11.9, 11.2, 11.1,
    ...     11.9, 12.2, 11.8, 11.4, 11.6, 13.0, 17.1, 18.2, 22.4, 21.4, 21.8,
    ...     22.2, 20.1, 17.8, 15.2, 14.5, 12.4, 11.7, 11.9)
    >>> inputs.tn.series = inputs.t.series-1.0
    >>> inputs.epn.series = (
    ...     0.100707, 0.097801, 0.096981, 0.09599, 0.096981, 0.102761,
    ...     0.291908, 1.932875, 4.369536, 7.317556, 8.264362, 9.369867,
    ...     5.126178, 6.62503, 7.397619, 2.39151, 1.829834, 1.136569,
    ...     0.750986, 0.223895, 0.099425, 0.098454, 0.098128, 0.097474,
    ...     0.097474, 0.097474, 0.096981, 0.096652, 0.096321, 0.09599,
    ...     0.187298, 1.264612, 3.045538, 1.930758, 2.461001, 6.215945,
    ...     3.374783, 8.821555, 4.046025, 2.110757, 2.239257, 2.877848,
    ...     1.591452, 0.291604, 0.092622, 0.092451, 0.091248, 0.089683,
    ...     0.089858, 0.089683, 0.088805, 0.089157, 0.090207, 0.091593,
    ...     0.154861, 0.470369, 1.173726, 4.202296, 4.359715, 5.305753,
    ...     5.376027, 4.658915, 7.789594, 4.851567, 5.30692, 3.286036,
    ...     1.506216, 0.274762, 0.087565, 0.085771, 0.084317, 0.083215,
    ...     0.082289, 0.0845, 0.084864, 0.083584, 0.0834, 0.084864, 0.310229,
    ...     1.391958, 3.195876, 5.191651, 7.155036, 8.391432, 8.391286,
    ...     10.715238, 9.383394, 7.861915, 6.298329, 2.948416, 1.309232,
    ...     0.32955, 0.089508, 0.085771, 0.0845, 0.084864)

    In the first example, the |RespArea| option is disabled and a
    relatively large value for the accuracy related parameter |RecStep|
    is set:

    >>> resparea(False)
    >>> recstep(100)

    The following results show the response of application model |hland_v1|
    to the given extreme precipitation event, which is strongly
    attenuated by the large evaporation values.  One striking difference
    to other models like |lland_v2| is the block-like appearance of
    percolation (|Perc|), which is one reason for the unusual transitions
    between event periods (with relevant amounts of both runoff components
    |Q0| and |Q1|) and the subsequent pure base flow periods (with relevant
    amounts of |Q1| only):

    >>> test('hland_v1_ex1')
    |         date |    p |    t |   tn |       epn | tmean |   tc | fracrain | rfc | sfc |      pc |        ep |      epc |       ei |        tf | glmelt | melt | refr |       in_ |         r |       ea | cfpot |       cf |     perc | contriarea |      inuz |        q0 |  el |       q1 |      inuh |     outuh |        qt |       ic |  sp |  wc |         sm |        uz |        lz |   outlet |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. 00:00 |  0.0 | 21.2 | 20.2 |  0.100707 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |     0.0 |   0.11682 |  0.08411 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.052569 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 |     0.05 |      0.05 |  0.061111 |  0.051111 |      0.0 | 0.0 | 0.0 |  99.947431 |       0.0 |      9.95 | 0.014198 |
    | 01.01. 01:00 |  0.0 | 19.4 | 18.4 |  0.097801 |  20.0 | 20.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.113449 | 0.081683 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.051025 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 |  0.04975 |   0.04975 |  0.088833 |  0.078833 |      0.0 | 0.0 | 0.0 |  99.896406 |       0.0 |   9.90025 | 0.021898 |
    | 01.01. 02:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.050572 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.049501 |  0.049501 |   0.04975 |   0.03975 |      0.0 | 0.0 | 0.0 |  99.845834 |       0.0 |  9.850749 | 0.011042 |
    | 01.01. 03:00 |  0.0 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  0.111348 | 0.080171 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.05003 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.049254 |  0.049254 |  0.049502 |  0.039502 |      0.0 | 0.0 | 0.0 |  99.795804 |       0.0 |  9.801495 | 0.010973 |
    | 01.01. 04:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.050521 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.049007 |  0.049007 |  0.049254 |  0.039254 |      0.0 | 0.0 | 0.0 |  99.745284 |       0.0 |  9.752488 | 0.010904 |
    | 01.01. 05:00 |  0.0 | 22.5 | 21.5 |  0.102761 |  23.1 | 23.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.119203 | 0.085826 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.053505 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.048762 |  0.048762 |  0.049008 |  0.039008 |      0.0 | 0.0 | 0.0 |  99.691779 |       0.0 |  9.703725 | 0.010835 |
    | 01.01. 06:00 |  0.0 | 25.1 | 24.1 |  0.291908 |  25.7 | 25.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.338613 | 0.243802 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.151906 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.048519 |  0.048519 |  0.048763 |  0.038763 |      0.0 | 0.0 | 0.0 |  99.539873 |       0.0 |  9.655206 | 0.010767 |
    | 01.01. 07:00 |  0.0 | 28.3 | 27.3 |  1.932875 |  28.9 | 28.9 |      1.0 | 1.1 | 0.0 |     0.0 |  2.242135 | 1.614337 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.004318 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.048276 |  0.048276 |  0.048519 |  0.038519 |      0.0 | 0.0 | 0.0 |  98.535555 |       0.0 |   9.60693 |   0.0107 |
    | 01.01. 08:00 |  0.0 | 27.8 | 26.8 |  4.369536 |  28.4 | 28.4 |      1.0 | 1.1 | 0.0 |     0.0 |  5.068662 | 3.649436 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.247495 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.048035 |  0.048035 |  0.048276 |  0.038276 |      0.0 | 0.0 | 0.0 |  96.288059 |       0.0 |  9.558896 | 0.010632 |
    | 01.01. 09:00 |  0.0 | 31.4 | 30.4 |  7.317556 |  32.0 | 32.0 |      1.0 | 1.1 | 0.0 |     0.0 |  8.488365 | 6.111623 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.677977 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.047794 |  0.047794 |  0.048035 |  0.038035 |      0.0 | 0.0 | 0.0 |  92.610082 |       0.0 |  9.511101 | 0.010565 |
    | 01.01. 10:00 |  0.0 | 32.2 | 31.2 |  8.264362 |  32.8 | 32.8 |      1.0 | 1.1 | 0.0 |     0.0 |   9.58666 | 6.902395 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.995196 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.047556 |  0.047556 |  0.047795 |  0.037795 |      0.0 | 0.0 | 0.0 |  88.614886 |       0.0 |  9.463546 | 0.010499 |
    | 01.01. 11:00 |  0.0 | 35.2 | 34.2 |  9.369867 |  35.8 | 35.8 |      1.0 | 1.1 | 0.0 |     0.0 | 10.869046 | 7.825713 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.334217 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.047318 |  0.047318 |  0.047556 |  0.037556 |      0.0 | 0.0 | 0.0 |   84.28067 |       0.0 |  9.416228 | 0.010432 |
    | 01.01. 12:00 |  0.0 | 37.1 | 36.1 |  5.126178 |  37.7 | 37.7 |      1.0 | 1.1 | 0.0 |     0.0 |  5.946366 | 4.281384 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.255237 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.047081 |  0.047081 |  0.047318 |  0.037318 |      0.0 | 0.0 | 0.0 |  82.025433 |       0.0 |  9.369147 | 0.010366 |
    | 01.01. 13:00 |  0.0 | 31.2 | 30.2 |   6.62503 |  31.8 | 31.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.685035 | 5.533225 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.836657 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.046846 |  0.046846 |  0.047081 |  0.037081 |      0.0 | 0.0 | 0.0 |  79.188775 |       0.0 |  9.322301 |   0.0103 |
    | 01.01. 14:00 |  0.0 | 24.3 | 23.3 |  7.397619 |  24.9 | 24.9 |      1.0 | 1.1 | 0.0 |     0.0 |  8.581238 | 6.178491 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  3.05792 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.046612 |  0.046612 |  0.046846 |  0.036846 |      0.0 | 0.0 | 0.0 |  76.130856 |       0.0 |   9.27569 | 0.010235 |
    | 01.01. 15:00 |  0.2 | 25.4 | 24.4 |   2.39151 |  26.0 | 26.0 |      1.0 | 1.1 | 0.0 |  0.2376 |  2.774152 | 1.950491 |   0.2376 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.928078 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.046378 |  0.046378 |  0.046612 |  0.036612 |      0.0 | 0.0 | 0.0 |  75.202777 |       0.0 |  9.229311 |  0.01017 |
    | 01.01. 16:00 |  0.0 | 25.9 | 24.9 |  1.829834 |  26.5 | 26.5 |      1.0 | 1.1 | 0.0 |     0.0 |  2.122607 | 1.528277 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.718317 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.046147 |  0.046147 |  0.046379 |  0.036379 |      0.0 | 0.0 | 0.0 |  74.484461 |       0.0 |  9.183165 | 0.010105 |
    | 01.01. 17:00 |  0.0 | 23.7 | 22.7 |  1.136569 |  24.3 | 24.3 |      1.0 | 1.1 | 0.0 |     0.0 |   1.31842 | 0.949262 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.441908 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.045916 |  0.045916 |  0.046147 |  0.036147 |      0.0 | 0.0 | 0.0 |  74.042552 |       0.0 |  9.137249 | 0.010041 |
    | 01.01. 18:00 |  1.3 | 21.6 | 20.6 |  0.750986 |  22.2 | 22.2 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.871144 | 0.537465 | 0.537465 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.12436 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.045686 |  0.045686 |  0.045916 |  0.035916 | 1.006935 | 0.0 | 0.0 |  73.918192 |       0.0 |  9.091563 | 0.009977 |
    | 01.01. 19:00 |  5.6 | 21.2 | 20.2 |  0.223895 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |  6.6528 |  0.259718 | 0.096141 | 0.096141 |  5.659735 |    0.0 |  0.0 |  0.0 |  5.659735 |  0.773106 | 0.023694 |   nan | 0.060598 |      0.5 |        1.0 |  0.712508 |  0.000002 | 0.0 | 0.047958 |   0.04796 |  0.046243 |  0.036243 | 1.903859 | 0.0 | 0.0 |  78.841725 |  0.212506 |  9.543605 | 0.010067 |
    | 01.01. 20:00 |  2.9 | 20.4 | 19.4 |  0.099425 |  21.0 | 21.0 |      1.0 | 1.1 | 0.0 |  3.4452 |  0.115333 | 0.058839 | 0.058839 |  3.349059 |    0.0 |  0.0 |  0.0 |  3.349059 |  0.520445 | 0.015028 |   nan | 0.059165 |      0.5 |        1.0 |   0.46128 |  0.000007 | 0.0 | 0.050218 |  0.050225 |  0.047958 |  0.037958 | 1.941161 | 0.0 | 0.0 |  81.714476 |  0.173779 |  9.993387 | 0.010544 |
    | 01.01. 21:00 |  4.9 | 19.8 | 18.8 |  0.098454 |  20.4 | 20.4 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.114207 | 0.045942 | 0.045942 |  5.762361 |    0.0 |  0.0 |  0.0 |  5.762361 |  0.961919 | 0.012429 |   nan | 0.056743 |      0.5 |        1.0 |  0.905176 |   0.00007 | 0.0 | 0.052467 |  0.052537 |  0.050236 |  0.040236 | 1.954058 | 0.0 | 0.0 |  86.559232 |  0.578886 |  10.44092 | 0.011177 |
    | 01.01. 22:00 | 10.6 | 19.6 | 18.6 |  0.098128 |  20.2 | 20.2 |      1.0 | 1.1 | 0.0 | 12.5928 |  0.113828 | 0.023264 | 0.023264 | 12.546858 |    0.0 |  0.0 |  0.0 | 12.546858 |  2.350184 | 0.007038 |   nan | 0.051622 |      0.5 |        1.0 |  2.298561 |  0.004477 | 0.0 | 0.054705 |  0.059182 |    0.0535 |    0.0435 | 1.976736 | 0.0 | 0.0 |  96.800491 |   2.37297 | 10.886215 | 0.012083 |
    | 01.01. 23:00 |  0.1 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.1188 |   0.11307 | 0.080449 | 0.080449 |  0.095536 |    0.0 |  0.0 |  0.0 |  0.095536 |   0.02238 | 0.024367 |   nan | 0.051563 |      0.5 |        1.0 | -0.029183 |   0.00942 | 0.0 | 0.056931 |  0.066351 |  0.059298 |  0.049298 | 1.919551 | 0.0 | 0.0 |  96.900842 |  1.834367 | 11.329284 | 0.013694 |
    | 02.01. 00:00 |  0.7 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.8316 |   0.11307 | 0.074914 | 0.074914 |  0.751151 |    0.0 |  0.0 |  0.0 |  0.751151 |  0.176328 | 0.022832 |   nan | 0.051262 |      0.5 |        1.0 |  0.125066 |  0.004491 | 0.0 | 0.059146 |  0.063637 |  0.064155 |  0.054155 | 1.925086 | 0.0 | 0.0 |  97.504096 |  1.454943 | 11.770138 | 0.015043 |
    | 02.01. 01:00 |  3.0 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |   3.564 |   0.11307 | 0.057003 | 0.057003 |  3.489086 |    0.0 |  0.0 |  0.0 |  3.489086 |  0.829273 | 0.017851 |   nan | 0.049918 |      0.5 |        1.0 |  0.779355 |  0.004082 | 0.0 | 0.061351 |  0.065432 |  0.064639 |  0.054639 | 1.942997 | 0.0 | 0.0 | 100.195975 |  1.730216 | 12.208787 | 0.015178 |
    | 02.01. 02:00 |  2.1 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |  2.4948 |  0.112498 | 0.063115 | 0.063115 |  2.437797 |    0.0 |  0.0 |  0.0 |  2.437797 |   0.61184 | 0.020132 |   nan | 0.048989 |      0.5 |        1.0 |  0.562851 |  0.005447 | 0.0 | 0.063544 |  0.068991 |  0.065824 |  0.055824 | 1.936885 | 0.0 | 0.0 | 102.050789 |   1.78762 | 12.645243 | 0.015507 |
    | 02.01. 03:00 | 10.4 | 18.7 | 17.7 |  0.096652 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 | 12.3552 |  0.112116 | 0.023465 | 0.023465 | 12.292085 |    0.0 |  0.0 |  0.0 | 12.292085 |  3.200356 | 0.008153 |   nan | 0.044429 |      0.5 |        1.0 |  3.155927 |  0.035664 | 0.0 | 0.065726 |   0.10139 |    0.0754 |    0.0654 | 1.976535 | 0.0 | 0.0 | 111.178794 |  4.407884 | 13.079517 | 0.018167 |
    | 02.01. 04:00 |  3.5 | 18.5 | 17.5 |  0.096321 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |   4.158 |  0.111732 |  0.05308 |  0.05308 |  4.134535 |    0.0 |  0.0 |  0.0 |  4.134535 |  1.277646 | 0.018923 |   nan | 0.042982 |      0.5 |        1.0 |  1.234664 |  0.106278 | 0.0 | 0.067898 |  0.174175 |  0.110365 |  0.100365 |  1.94692 | 0.0 | 0.0 | 114.059742 |   5.03627 | 13.511619 | 0.027879 |
    | 02.01. 05:00 |  3.4 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |  4.0392 |  0.111348 |  0.05353 |  0.05353 |   3.98612 |    0.0 |  0.0 |  0.0 |   3.98612 |  1.296448 | 0.019537 |   nan | 0.041625 |      0.5 |        1.0 |  1.254823 |  0.153262 | 0.0 | 0.070058 |   0.22332 |  0.168922 |  0.158922 |  1.94647 | 0.0 | 0.0 | 116.771503 |  5.637831 | 13.941561 | 0.044145 |
    | 02.01. 06:00 |  1.2 | 18.5 | 17.5 |  0.187298 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |  1.4256 |  0.217266 | 0.135647 | 0.135647 |   1.37207 |    0.0 |  0.0 |  0.0 |   1.37207 |  0.467724 |   0.0499 |   nan | 0.041162 |      0.5 |        1.0 |  0.426562 |  0.167893 | 0.0 | 0.072208 |  0.240101 |  0.216128 |  0.206128 | 1.864353 | 0.0 | 0.0 |  117.66711 |    5.3965 | 14.369353 | 0.057258 |
    | 02.01. 07:00 |  0.1 | 18.8 | 17.8 |  1.264612 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  0.1188 |   1.46695 |  1.04373 |  1.04373 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.383924 |   nan | 0.041166 |      0.5 |        1.0 | -0.041166 |  0.129717 | 0.0 | 0.074347 |  0.204064 |  0.228364 |  0.218364 | 0.939422 | 0.0 | 0.0 | 117.324353 |  4.725616 | 14.795007 | 0.060657 |
    | 02.01. 08:00 |  0.0 | 18.8 | 17.8 |  3.045538 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |     0.0 |  3.532824 | 2.543633 | 0.939422 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.735028 |   nan | 0.041338 |      0.5 |        1.0 | -0.041338 |  0.086003 | 0.0 | 0.076475 |  0.162478 |  0.202831 |  0.192831 |      0.0 | 0.0 | 0.0 | 115.630662 |  4.098276 | 15.218532 | 0.053564 |
    | 02.01. 09:00 |  0.0 | 19.0 | 18.0 |  1.930758 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |     0.0 |  2.239679 | 1.612569 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.165815 |   nan | 0.042185 |      0.5 |        1.0 | -0.042185 |  0.054998 | 0.0 | 0.078593 |  0.133591 |    0.1653 |    0.1553 |      0.0 | 0.0 | 0.0 | 114.507032 |  3.501093 | 15.639939 | 0.043139 |
    | 02.01. 10:00 |  0.4 | 19.2 | 18.2 |  2.461001 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.4752 |  2.854761 | 1.960038 |   0.4752 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.403262 |   nan | 0.042746 |      0.5 |        1.0 | -0.042746 |  0.033312 | 0.0 |   0.0807 |  0.114012 |  0.135659 |  0.125659 |      0.0 | 0.0 | 0.0 | 113.146516 |  2.925034 | 16.059239 | 0.034905 |
    | 02.01. 11:00 |  0.1 | 19.3 | 18.3 |  6.215945 |  19.9 | 19.9 |      1.0 | 1.1 | 0.0 |  0.1188 |  7.210496 | 5.130246 |   0.1188 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.629327 |   nan | 0.043427 |      0.5 |        1.0 | -0.043427 |  0.018617 | 0.0 | 0.082796 |  0.101413 |  0.115563 |  0.105563 |      0.0 | 0.0 | 0.0 | 109.560616 |  2.362991 | 16.476443 | 0.029323 |
    | 02.01. 12:00 |  3.6 | 19.0 | 18.0 |  3.374783 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |  4.2768 |  3.914748 | 1.837796 | 1.837796 |    2.2768 |    0.0 |  0.0 |  0.0 |    2.2768 |  0.683241 | 0.638626 |   nan | 0.044423 |      0.5 |        1.0 |  0.638818 |  0.014291 | 0.0 | 0.084882 |  0.099173 |  0.103715 |  0.093715 | 0.162204 | 0.0 | 0.0 | 110.559972 |  2.487517 | 16.891561 | 0.026032 |
    | 02.01. 13:00 |  5.9 | 18.8 | 17.8 |  8.821555 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  7.0092 | 10.233004 | 3.655358 |      2.0 |  5.171404 |    0.0 |  0.0 |  0.0 |  5.171404 |  1.580317 | 2.132116 |   nan | 0.042924 |      0.5 |        1.0 |  1.537393 |  0.027763 | 0.0 | 0.086958 |  0.114721 |  0.103126 |  0.093126 |      0.0 | 0.0 | 0.0 | 112.061866 |  3.497147 | 17.304603 | 0.025868 |
    | 02.01. 14:00 |  1.1 | 18.7 | 17.7 |  4.046025 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 |  1.3068 |  4.693389 | 2.965278 |   1.3068 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.868067 |   nan | 0.043969 |      0.5 |        1.0 | -0.043969 |  0.033174 | 0.0 | 0.089023 |  0.122197 |  0.112927 |  0.102927 |      0.0 | 0.0 | 0.0 | 110.237768 |  2.920004 |  17.71558 | 0.028591 |
    | 02.01. 15:00 | 20.7 | 17.8 | 16.8 |  2.110757 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 | 24.5916 |  2.448478 |  0.15074 |  0.15074 |   22.5916 |    0.0 |  0.0 |  0.0 |   22.5916 |  6.863535 | 0.059355 |   nan | 0.037017 |      0.5 |        1.0 |  6.826517 |  0.275437 | 0.0 | 0.091078 |  0.366515 |  0.174829 |  0.164829 |  1.84926 | 0.0 | 0.0 | 125.943496 |  8.971084 | 18.124502 | 0.045786 |
    | 02.01. 16:00 | 37.9 | 17.4 | 16.4 |  2.239257 |  18.0 | 18.0 |      1.0 | 1.1 | 0.0 | 45.0252 |  2.597538 | 0.020724 | 0.020724 |  44.87446 |    0.0 |  0.0 |  0.0 |  44.87446 | 17.794702 | 0.009912 |   nan | 0.023488 |      0.5 |        1.0 | 17.771214 |  4.821721 | 0.0 | 0.093123 |  4.914843 |  1.322962 |  1.312962 | 1.979276 | 0.0 | 0.0 |  153.03683 | 21.420577 |  18.53138 | 0.364712 |
    | 02.01. 17:00 |  8.2 | 17.3 | 16.3 |  2.877848 |  17.9 | 17.9 |      1.0 | 1.1 | 0.0 |  9.7416 |  3.338304 | 0.907373 | 0.907373 |  9.720876 |    0.0 |  0.0 |  0.0 |  9.720876 |  5.691639 | 0.445428 |   nan | 0.021467 |      0.5 |        1.0 |  5.670172 |  7.878038 | 0.0 | 0.095157 |  7.973195 |  4.583738 |  4.573738 | 1.092627 | 0.0 | 0.0 | 156.642106 |  18.71271 | 18.936223 | 1.270483 |
    | 02.01. 18:00 |  3.6 | 16.8 | 15.8 |  1.591452 |  17.4 | 17.4 |      1.0 | 1.1 | 0.0 |  4.2768 |  1.846084 | 0.866652 | 0.866652 |  3.369427 |    0.0 |  0.0 |  0.0 |  3.369427 |  2.066869 | 0.427817 |   nan | 0.021028 |      0.5 |        1.0 |  2.045842 |  4.840645 | 0.0 | 0.097181 |  4.937827 |  6.619035 |  6.609035 | 1.133348 | 0.0 | 0.0 | 157.537874 | 15.417906 | 19.339042 | 1.835843 |
    | 02.01. 19:00 |  7.5 | 16.5 | 15.5 |  0.291604 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |    8.91 |  0.338261 | 0.099914 | 0.099914 |  8.043348 |    0.0 |  0.0 |  0.0 |  8.043348 |  4.990532 | 0.049957 |   nan | 0.019705 |      0.5 |        1.0 |  4.970827 |    3.9218 | 0.0 | 0.099195 |  4.020995 |  5.408613 |  5.398613 | 1.900086 | 0.0 | 0.0 | 160.560437 | 15.966933 | 19.739846 | 1.499615 |
    | 02.01. 20:00 | 18.5 | 16.3 | 15.3 |  0.092622 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  21.978 |  0.107442 |  0.00859 |  0.00859 | 21.878086 |    0.0 |  0.0 |  0.0 | 21.878086 | 14.100237 | 0.004295 |   nan | 0.015831 |      0.5 |        1.0 | 14.084406 |  7.677383 | 0.0 | 0.101199 |  7.778582 |  5.059755 |  5.049755 |  1.99141 | 0.0 | 0.0 | 168.349822 | 21.873957 | 20.138647 |  1.40271 |
    | 02.01. 21:00 | 15.4 | 16.2 | 15.2 |  0.092451 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 | 18.2952 |  0.107243 | 0.012392 | 0.012392 |  18.28661 |    0.0 |  0.0 |  0.0 |  18.28661 | 12.956823 | 0.006196 |   nan |  0.01316 |      0.5 |        1.0 | 12.943663 | 11.510418 | 0.0 | 0.103193 | 11.613611 |  7.795791 |  7.785791 | 1.987608 | 0.0 | 0.0 | 173.686572 | 22.807202 | 20.535454 |  2.16272 |
    | 02.01. 22:00 |  6.3 | 15.5 | 14.5 |  0.091248 |  16.1 | 16.1 |      1.0 | 1.1 | 0.0 |  7.4844 |  0.105848 | 0.036055 | 0.036055 |  7.472008 |    0.0 |  0.0 |  0.0 |  7.472008 |  5.635206 | 0.018028 |   nan | 0.012238 |      0.5 |        1.0 |  5.622968 |  8.843986 | 0.0 | 0.105177 |  8.949163 | 10.169283 | 10.159283 | 1.963945 | 0.0 | 0.0 | 175.517585 | 19.086184 | 20.930277 | 2.822023 |
    | 02.01. 23:00 |  1.9 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  2.2572 |  0.104032 | 0.059768 | 0.059768 |  2.221145 |    0.0 |  0.0 |  0.0 |  2.221145 |  1.710638 | 0.029884 |   nan | 0.011986 |      0.5 |        1.0 |  1.698652 |  4.947934 | 0.0 | 0.107151 |  5.055086 |  8.675912 |  8.665912 | 1.940232 | 0.0 | 0.0 | 176.010193 | 15.336902 | 21.323125 | 2.407198 |
    | 03.01. 00:00 |  4.9 | 14.7 | 13.7 |  0.089858 |  15.3 | 15.3 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.104235 | 0.041931 | 0.041931 |  5.761432 |    0.0 |  0.0 |  0.0 |  5.761432 |  4.462169 | 0.020966 |   nan | 0.011345 |      0.5 |        1.0 |  4.450824 |  3.725205 | 0.0 | 0.109116 |   3.83432 |  5.649155 |  5.639155 | 1.958069 | 0.0 | 0.0 | 177.299835 | 15.562521 |  21.71401 | 1.566432 |
    | 03.01. 01:00 |  2.7 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  3.2076 |  0.104032 |  0.05435 |  0.05435 |  3.165669 |    0.0 |  0.0 |  0.0 |  3.165669 |  2.487838 | 0.027175 |   nan | 0.011011 |      0.5 |        1.0 |  2.476827 |  3.288302 | 0.0 |  0.11107 |  3.399372 |  4.008946 |  3.998946 |  1.94565 | 0.0 | 0.0 | 177.961502 | 14.251047 |  22.10294 | 1.110818 |
    | 03.01. 02:00 |  0.5 | 14.1 | 13.1 |  0.088805 |  14.7 | 14.7 |      1.0 | 1.1 | 0.0 |   0.594 |  0.103014 | 0.069893 | 0.069893 |   0.53965 |    0.0 |  0.0 |  0.0 |   0.53965 |  0.427272 | 0.034946 |   nan | 0.010963 |      0.5 |        1.0 |  0.416309 |  2.220294 | 0.0 | 0.113015 |  2.333308 |  3.259124 |  3.249124 | 1.930107 | 0.0 | 0.0 | 178.049897 | 11.947062 | 22.489925 | 0.902534 |
    | 03.01. 03:00 |  0.2 | 14.3 | 13.3 |  0.089157 |  14.9 | 14.9 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.103422 | 0.072716 | 0.072716 |  0.167707 |    0.0 |  0.0 |  0.0 |  0.167707 |  0.132916 | 0.036358 |   nan | 0.010958 |      0.5 |        1.0 |  0.121958 |  1.351723 | 0.0 |  0.11495 |  1.466673 |  2.377626 |  2.367626 | 1.927284 | 0.0 | 0.0 | 178.059289 | 10.217297 | 22.874975 | 0.657674 |
    | 03.01. 04:00 |  0.5 | 14.9 | 13.9 |  0.090207 |  15.5 | 15.5 |      1.0 | 1.1 | 0.0 |   0.594 |   0.10464 | 0.070996 | 0.070996 |  0.521284 |    0.0 |  0.0 |  0.0 |  0.521284 |  0.413185 | 0.035498 |   nan | 0.010916 |      0.5 |        1.0 |  0.402268 |  0.912964 | 0.0 | 0.116875 |  1.029839 |  1.562184 |  1.552184 | 1.929004 | 0.0 | 0.0 | 178.142807 |  9.206601 |   23.2581 | 0.431162 |
    | 03.01. 05:00 |  2.4 | 15.7 | 14.7 |  0.091593 |  16.3 | 16.3 |      1.0 | 1.1 | 0.0 |  2.8512 |  0.106248 | 0.057521 | 0.057521 |  2.780204 |    0.0 |  0.0 |  0.0 |  2.780204 |  2.205735 | 0.028761 |   nan | 0.010641 |      0.5 |        1.0 |  2.195093 |  0.896634 | 0.0 | 0.118791 |  1.015425 |   1.12371 |   1.11371 | 1.942479 | 0.0 | 0.0 | 178.699157 |  10.00506 |  23.63931 | 0.309364 |
    | 03.01. 06:00 |  0.4 | 16.0 | 15.0 |  0.154861 |  16.6 | 16.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  0.179639 | 0.123337 | 0.123337 |  0.417679 |    0.0 |  0.0 |  0.0 |  0.417679 |  0.333448 | 0.061669 |   nan | 0.010608 |      0.5 |        1.0 |  0.322839 |  0.851988 | 0.0 | 0.120697 |  0.972684 |   1.00913 |   0.99913 | 1.876663 | 0.0 | 0.0 | 178.732328 |  8.975912 | 24.018613 | 0.277536 |
    | 03.01. 07:00 |  0.2 | 16.7 | 15.7 |  0.470369 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.545628 | 0.383628 | 0.383628 |  0.114263 |    0.0 |  0.0 |  0.0 |  0.114263 |  0.091254 | 0.191814 |   nan | 0.010622 |      0.5 |        1.0 |  0.080631 |  0.604807 | 0.0 | 0.122593 |    0.7274 |  0.927674 |  0.917674 | 1.616372 | 0.0 | 0.0 | 178.574145 |  7.951736 |  24.39602 |  0.25491 |
    | 03.01. 08:00 |  0.0 | 17.1 | 16.1 |  1.173726 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  1.361522 | 0.980296 | 0.980296 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.490148 |   nan | 0.010713 |      0.5 |        1.0 | -0.010713 |  0.419019 | 0.0 |  0.12448 |  0.543499 |  0.741041 |  0.731041 | 0.636076 | 0.0 | 0.0 |  178.09471 |  7.022004 |  24.77154 | 0.203067 |
    | 03.01. 09:00 |  0.0 | 16.2 | 15.2 |  4.202296 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 |     0.0 |  4.874663 | 3.509758 | 0.636076 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  3.19172 |   nan | 0.010953 |      0.5 |        1.0 | -0.010953 |  0.290078 | 0.0 | 0.126358 |  0.416436 |   0.55613 |   0.54613 |      0.0 | 0.0 | 0.0 | 174.913943 |  6.220974 | 25.145182 | 0.151703 |
    | 03.01. 10:00 |  0.3 | 15.9 | 14.9 |  4.359715 |  16.5 | 16.5 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.057269 | 3.513746 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.335546 |   nan | 0.012543 |      0.5 |        1.0 | -0.012543 |  0.201588 | 0.0 | 0.128226 |  0.329814 |  0.425423 |  0.415423 |      0.0 | 0.0 | 0.0 | 171.590941 |  5.506843 | 25.516957 | 0.115395 |
    | 03.01. 11:00 |  2.6 | 16.3 | 15.3 |  5.305753 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  3.0888 |  6.154673 | 3.253813 |      2.0 |    1.0888 |    0.0 |  0.0 |  0.0 |    1.0888 |  0.801451 | 2.253813 |   nan | 0.014061 |      0.5 |        1.0 |   0.78739 |  0.172588 | 0.0 | 0.130085 |  0.302673 |  0.343032 |  0.333032 |      0.0 | 0.0 | 0.0 | 169.638537 |  5.621644 | 25.886872 | 0.092509 |
    | 03.01. 12:00 |  0.7 | 16.3 | 15.3 |  5.376027 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  0.8316 |  6.236191 | 4.131769 |   0.8316 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.715969 |   nan | 0.015181 |      0.5 |        1.0 | -0.015181 |  0.148076 | 0.0 | 0.131934 |   0.28001 |  0.303668 |  0.293668 |      0.0 | 0.0 | 0.0 | 165.937749 |  4.958388 | 26.254937 | 0.081574 |
    | 03.01. 13:00 |  0.3 | 16.4 | 15.4 |  4.658915 |  17.0 | 17.0 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.404341 | 3.754888 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.576688 |   nan | 0.017031 |      0.5 |        1.0 | -0.017031 |  0.100609 | 0.0 | 0.133775 |  0.234383 |  0.274907 |  0.264907 |      0.0 | 0.0 | 0.0 | 162.378092 |  4.340748 | 26.621163 | 0.073585 |
    | 03.01. 14:00 |  0.3 | 16.5 | 15.5 |  7.789594 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |  0.3564 |  9.035929 | 6.278083 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 6.099883 |   nan | 0.018811 |      0.5 |        1.0 | -0.018811 |  0.066455 | 0.0 | 0.135606 |  0.202061 |   0.23734 |   0.22734 |      0.0 | 0.0 | 0.0 |  156.29702 |  3.755482 | 26.985557 |  0.06315 |
    | 03.01. 15:00 |  0.0 | 18.4 | 17.4 |  4.851567 |  19.0 | 19.0 |      1.0 | 1.1 | 0.0 |     0.0 |  5.627818 | 4.052029 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.958804 |   nan | 0.021851 |      0.5 |        1.0 | -0.021851 |  0.042037 | 0.0 | 0.137428 |  0.179465 |  0.204222 |  0.194222 |      0.0 | 0.0 | 0.0 | 152.360068 |  3.191593 | 27.348129 | 0.053951 |
    | 03.01. 16:00 |  0.0 | 18.3 | 17.3 |   5.30692 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  6.156027 |  4.43234 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.221357 |   nan |  0.02382 |      0.5 |        1.0 |  -0.02382 |  0.024952 | 0.0 | 0.139241 |  0.164192 |  0.181093 |  0.171093 |      0.0 | 0.0 | 0.0 | 148.162531 |  2.642821 | 27.708889 | 0.047526 |
    | 03.01. 17:00 |  0.0 | 18.1 | 17.1 |  3.286036 |  18.7 | 18.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.811802 | 2.744497 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.541892 |   nan | 0.025919 |      0.5 |        1.0 | -0.025919 |  0.013481 | 0.0 | 0.141044 |  0.154525 |  0.165438 |  0.155438 |      0.0 | 0.0 | 0.0 | 145.646557 |  2.103421 | 28.067844 | 0.043177 |
    | 03.01. 18:00 |  0.0 | 16.7 | 15.7 |  1.506216 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |     0.0 |  1.747211 | 1.257992 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.145352 |   nan | 0.027177 |      0.5 |        1.0 | -0.027177 |  0.006295 | 0.0 | 0.142839 |  0.149135 |  0.155476 |  0.145476 |      0.0 | 0.0 | 0.0 | 144.528382 |  1.569949 | 28.425005 |  0.04041 |
    | 03.01. 19:00 |  0.0 | 15.2 | 14.2 |  0.274762 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.318724 | 0.229481 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.207331 |   nan | 0.027736 |      0.5 |        1.0 | -0.027736 |  0.002299 | 0.0 | 0.144625 |  0.146924 |  0.149841 |  0.139841 |      0.0 | 0.0 | 0.0 | 144.348787 |  1.039914 |  28.78038 | 0.038845 |
    | 03.01. 20:00 |  0.0 | 13.4 | 12.4 |  0.087565 |  14.0 | 14.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.101575 | 0.073134 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.065993 |   nan | 0.027826 |      0.5 |        1.0 | -0.027826 |  0.000516 | 0.0 | 0.146402 |  0.146918 |  0.147414 |  0.137414 |      0.0 | 0.0 | 0.0 |  144.31062 |  0.511573 | 29.133978 | 0.038171 |
    | 03.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.064624 |   nan | 0.027845 | 0.483697 |        1.0 | -0.027845 |  0.000032 | 0.0 | 0.148088 |   0.14812 |  0.147186 |  0.137186 |      0.0 | 0.0 | 0.0 |  144.27384 |       0.0 | 29.469586 | 0.038107 |
    | 03.01. 22:00 |  0.0 | 11.6 | 10.6 |  0.084317 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |     0.0 |  0.097808 | 0.070422 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |   0.0635 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.147348 |  0.147348 |  0.147681 |  0.137681 |      0.0 | 0.0 | 0.0 |  144.21034 |       0.0 | 29.322238 | 0.038245 |
    | 03.01. 23:00 |  0.0 | 11.0 | 10.0 |  0.083215 |  11.6 | 11.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096529 | 0.069501 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.062642 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.146611 |  0.146611 |  0.147356 |  0.137356 |      0.0 | 0.0 | 0.0 | 144.147698 |       0.0 | 29.175627 | 0.038154 |
    | 04.01. 00:00 |  0.0 | 10.5 |  9.5 |  0.082289 |  11.1 | 11.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.095455 | 0.068728 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.061918 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.145878 |  0.145878 |  0.146612 |  0.136612 |      0.0 | 0.0 | 0.0 |  144.08578 |       0.0 | 29.029749 | 0.037948 |
    | 04.01. 01:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063555 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.145149 |  0.145149 |  0.145879 |  0.135879 |      0.0 | 0.0 | 0.0 | 144.022225 |       0.0 |   28.8846 | 0.037744 |
    | 04.01. 02:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |   0.0638 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.144423 |  0.144423 |   0.14515 |   0.13515 |      0.0 | 0.0 | 0.0 | 143.958424 |       0.0 | 28.740177 | 0.037542 |
    | 04.01. 03:00 |  1.3 | 11.2 | 10.2 |  0.083584 |  11.8 | 11.8 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.096957 | 0.059819 | 0.059819 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.026911 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.143701 |  0.143701 |  0.144424 |  0.134424 | 1.484581 | 0.0 | 0.0 | 143.931513 |       0.0 | 28.596476 |  0.03734 |
    | 04.01. 04:00 |  0.0 | 11.1 | 10.1 |    0.0834 |  11.7 | 11.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096744 | 0.069656 | 0.069656 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.03133 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.142982 |  0.142982 |  0.143702 |  0.133702 | 1.414925 | 0.0 | 0.0 | 143.900183 |       0.0 | 28.453494 | 0.037139 |
    | 04.01. 05:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 | 0.070878 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.031873 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.142267 |  0.142267 |  0.142983 |  0.132983 | 1.344047 | 0.0 | 0.0 |  143.86831 |       0.0 | 28.311226 |  0.03694 |
    | 04.01. 06:00 |  0.0 | 12.2 | 11.2 |  0.310229 |  12.8 | 12.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.359866 | 0.259103 | 0.259103 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.11649 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.141556 |  0.141556 |  0.142268 |  0.132268 | 1.084943 | 0.0 | 0.0 |  143.75182 |       0.0 |  28.16967 | 0.036741 |
    | 04.01. 07:00 |  0.7 | 11.8 | 10.8 |  1.391958 |  12.4 | 12.4 |      1.0 | 1.1 | 0.0 |  0.8316 |  1.614671 | 1.069795 | 1.069795 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.480578 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.140848 |  0.140848 |  0.141557 |  0.131557 | 0.846748 | 0.0 | 0.0 | 143.271242 |       0.0 | 28.028822 | 0.036544 |
    | 04.01. 08:00 |  0.4 | 11.4 | 10.4 |  3.195876 |  12.0 | 12.0 |      1.0 | 1.1 | 0.0 |  0.4752 |  3.707216 | 2.545322 | 1.321948 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.751285 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.140144 |  0.140144 |  0.140849 |  0.130849 |      0.0 | 0.0 | 0.0 | 141.519957 |       0.0 | 27.888678 | 0.036347 |
    | 04.01. 09:00 |  0.1 | 11.6 | 10.6 |  5.191651 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |  0.1188 |  6.022315 | 4.284859 |   0.1188 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.789957 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.139443 |  0.139443 |  0.140145 |  0.130145 |      0.0 | 0.0 | 0.0 |     137.73 |       0.0 | 27.749234 | 0.036151 |
    | 04.01. 10:00 |  0.4 | 13.0 | 12.0 |  7.155036 |  13.6 | 13.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  8.299842 | 5.698554 |   0.4752 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.905386 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.138746 |  0.138746 |  0.139444 |  0.129444 |      0.0 | 0.0 | 0.0 | 132.824614 |       0.0 | 27.610488 | 0.035957 |
    | 04.01. 11:00 |  0.0 | 17.1 | 16.1 |  8.391432 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  9.734061 | 7.008524 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.818153 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.138052 |  0.138052 |  0.138747 |  0.128747 |      0.0 | 0.0 | 0.0 | 127.006461 |       0.0 | 27.472436 | 0.035763 |
    | 04.01. 12:00 |  0.0 | 18.2 | 17.2 |  8.391286 |  18.8 | 18.8 |      1.0 | 1.1 | 0.0 |     0.0 |  9.733892 | 7.008402 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.563202 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.137362 |  0.137362 |  0.138053 |  0.128053 |      0.0 | 0.0 | 0.0 | 121.443259 |       0.0 | 27.335074 |  0.03557 |
    | 04.01. 13:00 |  0.0 | 22.4 | 21.4 | 10.715238 |  23.0 | 23.0 |      1.0 | 1.1 | 0.0 |     0.0 | 12.429676 | 8.949367 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 6.792752 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.136675 |  0.136675 |  0.137363 |  0.127363 |      0.0 | 0.0 | 0.0 | 114.650507 |       0.0 | 27.198398 | 0.035379 |
    | 04.01. 14:00 |  0.0 | 21.4 | 20.4 |  9.383394 |  22.0 | 22.0 |      1.0 | 1.1 | 0.0 |     0.0 | 10.884737 | 7.837011 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.615733 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.135992 |  0.135992 |  0.136676 |  0.126676 |      0.0 | 0.0 | 0.0 | 109.034774 |       0.0 | 27.062406 | 0.035188 |
    | 04.01. 15:00 |  0.0 | 21.8 | 20.8 |  7.861915 |  22.4 | 22.4 |      1.0 | 1.1 | 0.0 |     0.0 |  9.119821 | 6.566271 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |   4.4747 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.135312 |  0.135312 |  0.135993 |  0.125993 |      0.0 | 0.0 | 0.0 | 104.560075 |       0.0 | 26.927094 | 0.034998 |
    | 04.01. 16:00 |  0.0 | 22.2 | 21.2 |  6.298329 |  22.8 | 22.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.306062 | 5.260364 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.437651 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.134635 |  0.134635 |  0.135313 |  0.125313 |      0.0 | 0.0 | 0.0 | 101.122424 |       0.0 | 26.792459 | 0.034809 |
    | 04.01. 17:00 |  0.0 | 20.1 | 19.1 |  2.948416 |  20.7 | 20.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.420163 | 2.462517 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.556348 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.133962 |  0.133962 |  0.134636 |  0.124636 |      0.0 | 0.0 | 0.0 |  99.566076 |       0.0 | 26.658496 | 0.034621 |
    | 04.01. 18:00 |  0.0 | 17.8 | 16.8 |  1.309232 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 |     0.0 |  1.518709 | 1.093471 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.680454 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.133292 |  0.133292 |  0.133963 |  0.123963 |      0.0 | 0.0 | 0.0 |  98.885622 |       0.0 | 26.525204 | 0.034434 |
    | 04.01. 19:00 |  0.0 | 15.2 | 14.2 |   0.32955 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.382278 |  0.27524 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.170108 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.132626 |  0.132626 |  0.133293 |  0.123293 |      0.0 | 0.0 | 0.0 |  98.715514 |       0.0 | 26.392578 | 0.034248 |
    | 04.01. 20:00 |  0.0 | 14.5 | 13.5 |  0.089508 |  15.1 | 15.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.103829 | 0.074757 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.046123 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.131963 |  0.131963 |  0.132627 |  0.122627 |      0.0 | 0.0 | 0.0 |  98.669391 |       0.0 | 26.260615 | 0.034063 |
    | 04.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.044177 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.131303 |  0.131303 |  0.131964 |  0.121964 |      0.0 | 0.0 | 0.0 |  98.625215 |       0.0 | 26.129312 | 0.033879 |
    | 04.01. 22:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.043503 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.130647 |  0.130647 |  0.131304 |  0.121304 |      0.0 | 0.0 | 0.0 |  98.581712 |       0.0 | 25.998665 | 0.033696 |
    | 04.01. 23:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.043671 |   nan |      0.0 |      0.0 |        1.0 |       0.0 |       0.0 | 0.0 | 0.129993 |  0.129993 |  0.130647 |  0.120647 |      0.0 | 0.0 | 0.0 |  98.538041 |       0.0 | 25.868672 | 0.033513 |

    .. raw:: html

        <iframe
            src="hland_v1_ex1.html"
            width="100%"
            height="930px"
            frameborder=0
        ></iframe>

    .. _hland_v1_ex2:

    **Example 2**

    The functionality of |hland_v1| can be changed substantially by
    enabling its |RespArea| option, which decreases |Perc| but increases
    |Q0| in dry periods (regarding relative soil moisture).  Hence the graph
    of |Perc| appears less blocky and reaches its maximum at the same time
    as the graph of |SM|, whereas |Q0| shows more pronounced peaks in the
    initial subperiod when the soil is not saturated yet:

    >>> resparea(True)
    >>> test('hland_v1_ex2')
    |         date |    p |    t |   tn |       epn | tmean |   tc | fracrain | rfc | sfc |      pc |        ep |      epc |       ei |        tf | glmelt | melt | refr |       in_ |         r |       ea | cfpot |       cf |     perc | contriarea |      inuz |        q0 |  el |       q1 |      inuh |    outuh |       qt |       ic |  sp |  wc |         sm |        uz |        lz |   outlet |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. 00:00 |  0.0 | 21.2 | 20.2 |  0.100707 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |     0.0 |   0.11682 |  0.08411 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.052569 |   nan |      0.0 |      0.0 |   0.249737 |       0.0 |       0.0 | 0.0 |     0.05 |      0.05 | 0.061111 | 0.051111 |      0.0 | 0.0 | 0.0 |  99.947431 |       0.0 |      9.95 | 0.014198 |
    | 01.01. 01:00 |  0.0 | 19.4 | 18.4 |  0.097801 |  20.0 | 20.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.113449 | 0.081683 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.051025 |   nan |      0.0 |      0.0 |   0.249482 |       0.0 |       0.0 | 0.0 |  0.04975 |   0.04975 | 0.088833 | 0.078833 |      0.0 | 0.0 | 0.0 |  99.896406 |       0.0 |   9.90025 | 0.021898 |
    | 01.01. 02:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.050572 |   nan |      0.0 |      0.0 |    0.24923 |       0.0 |       0.0 | 0.0 | 0.049501 |  0.049501 |  0.04975 |  0.03975 |      0.0 | 0.0 | 0.0 |  99.845834 |       0.0 |  9.850749 | 0.011042 |
    | 01.01. 03:00 |  0.0 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  0.111348 | 0.080171 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.05003 |   nan |      0.0 |      0.0 |    0.24898 |       0.0 |       0.0 | 0.0 | 0.049254 |  0.049254 | 0.049502 | 0.039502 |      0.0 | 0.0 | 0.0 |  99.795804 |       0.0 |  9.801495 | 0.010973 |
    | 01.01. 04:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.050521 |   nan |      0.0 |      0.0 |   0.248728 |       0.0 |       0.0 | 0.0 | 0.049007 |  0.049007 | 0.049254 | 0.039254 |      0.0 | 0.0 | 0.0 |  99.745284 |       0.0 |  9.752488 | 0.010904 |
    | 01.01. 05:00 |  0.0 | 22.5 | 21.5 |  0.102761 |  23.1 | 23.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.119203 | 0.085826 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.053505 |   nan |      0.0 |      0.0 |   0.248461 |       0.0 |       0.0 | 0.0 | 0.048762 |  0.048762 | 0.049008 | 0.039008 |      0.0 | 0.0 | 0.0 |  99.691779 |       0.0 |  9.703725 | 0.010835 |
    | 01.01. 06:00 |  0.0 | 25.1 | 24.1 |  0.291908 |  25.7 | 25.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.338613 | 0.243802 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.151906 |   nan |      0.0 |      0.0 |   0.247705 |       0.0 |       0.0 | 0.0 | 0.048519 |  0.048519 | 0.048763 | 0.038763 |      0.0 | 0.0 | 0.0 |  99.539873 |       0.0 |  9.655206 | 0.010767 |
    | 01.01. 07:00 |  0.0 | 28.3 | 27.3 |  1.932875 |  28.9 | 28.9 |      1.0 | 1.1 | 0.0 |     0.0 |  2.242135 | 1.614337 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.004318 |   nan |      0.0 |      0.0 |   0.242731 |       0.0 |       0.0 | 0.0 | 0.048276 |  0.048276 | 0.048519 | 0.038519 |      0.0 | 0.0 | 0.0 |  98.535555 |       0.0 |   9.60693 |   0.0107 |
    | 01.01. 08:00 |  0.0 | 27.8 | 26.8 |  4.369536 |  28.4 | 28.4 |      1.0 | 1.1 | 0.0 |     0.0 |  5.068662 | 3.649436 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.247495 |   nan |      0.0 |      0.0 |   0.231785 |       0.0 |       0.0 | 0.0 | 0.048035 |  0.048035 | 0.048276 | 0.038276 |      0.0 | 0.0 | 0.0 |  96.288059 |       0.0 |  9.558896 | 0.010632 |
    | 01.01. 09:00 |  0.0 | 31.4 | 30.4 |  7.317556 |  32.0 | 32.0 |      1.0 | 1.1 | 0.0 |     0.0 |  8.488365 | 6.111623 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.677977 |   nan |      0.0 |      0.0 |   0.214416 |       0.0 |       0.0 | 0.0 | 0.047794 |  0.047794 | 0.048035 | 0.038035 |      0.0 | 0.0 | 0.0 |  92.610082 |       0.0 |  9.511101 | 0.010565 |
    | 01.01. 10:00 |  0.0 | 32.2 | 31.2 |  8.264362 |  32.8 | 32.8 |      1.0 | 1.1 | 0.0 |     0.0 |   9.58666 | 6.902395 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.995196 |   nan |      0.0 |      0.0 |   0.196315 |       0.0 |       0.0 | 0.0 | 0.047556 |  0.047556 | 0.047795 | 0.037795 |      0.0 | 0.0 | 0.0 |  88.614886 |       0.0 |  9.463546 | 0.010499 |
    | 01.01. 11:00 |  0.0 | 35.2 | 34.2 |  9.369867 |  35.8 | 35.8 |      1.0 | 1.1 | 0.0 |     0.0 | 10.869046 | 7.825713 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.334217 |   nan |      0.0 |      0.0 |   0.177581 |       0.0 |       0.0 | 0.0 | 0.047318 |  0.047318 | 0.047556 | 0.037556 |      0.0 | 0.0 | 0.0 |   84.28067 |       0.0 |  9.416228 | 0.010432 |
    | 01.01. 12:00 |  0.0 | 37.1 | 36.1 |  5.126178 |  37.7 | 37.7 |      1.0 | 1.1 | 0.0 |     0.0 |  5.946366 | 4.281384 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.255237 |   nan |      0.0 |      0.0 |   0.168204 |       0.0 |       0.0 | 0.0 | 0.047081 |  0.047081 | 0.047318 | 0.037318 |      0.0 | 0.0 | 0.0 |  82.025433 |       0.0 |  9.369147 | 0.010366 |
    | 01.01. 13:00 |  0.0 | 31.2 | 30.2 |   6.62503 |  31.8 | 31.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.685035 | 5.533225 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.836657 |   nan |      0.0 |      0.0 |   0.156772 |       0.0 |       0.0 | 0.0 | 0.046846 |  0.046846 | 0.047081 | 0.037081 |      0.0 | 0.0 | 0.0 |  79.188775 |       0.0 |  9.322301 |   0.0103 |
    | 01.01. 14:00 |  0.0 | 24.3 | 23.3 |  7.397619 |  24.9 | 24.9 |      1.0 | 1.1 | 0.0 |     0.0 |  8.581238 | 6.178491 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  3.05792 |   nan |      0.0 |      0.0 |   0.144898 |       0.0 |       0.0 | 0.0 | 0.046612 |  0.046612 | 0.046846 | 0.036846 |      0.0 | 0.0 | 0.0 |  76.130856 |       0.0 |   9.27569 | 0.010235 |
    | 01.01. 15:00 |  0.2 | 25.4 | 24.4 |   2.39151 |  26.0 | 26.0 |      1.0 | 1.1 | 0.0 |  0.2376 |  2.774152 | 1.950491 |   0.2376 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.928078 |   nan |      0.0 |      0.0 |   0.141386 |       0.0 |       0.0 | 0.0 | 0.046378 |  0.046378 | 0.046612 | 0.036612 |      0.0 | 0.0 | 0.0 |  75.202777 |       0.0 |  9.229311 |  0.01017 |
    | 01.01. 16:00 |  0.0 | 25.9 | 24.9 |  1.829834 |  26.5 | 26.5 |      1.0 | 1.1 | 0.0 |     0.0 |  2.122607 | 1.528277 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.718317 |   nan |      0.0 |      0.0 |   0.138698 |       0.0 |       0.0 | 0.0 | 0.046147 |  0.046147 | 0.046379 | 0.036379 |      0.0 | 0.0 | 0.0 |  74.484461 |       0.0 |  9.183165 | 0.010105 |
    | 01.01. 17:00 |  0.0 | 23.7 | 22.7 |  1.136569 |  24.3 | 24.3 |      1.0 | 1.1 | 0.0 |     0.0 |   1.31842 | 0.949262 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.441908 |   nan |      0.0 |      0.0 |   0.137057 |       0.0 |       0.0 | 0.0 | 0.045916 |  0.045916 | 0.046147 | 0.036147 |      0.0 | 0.0 | 0.0 |  74.042552 |       0.0 |  9.137249 | 0.010041 |
    | 01.01. 18:00 |  1.3 | 21.6 | 20.6 |  0.750986 |  22.2 | 22.2 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.871144 | 0.537465 | 0.537465 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.12436 |   nan |      0.0 |      0.0 |   0.136597 |       0.0 |       0.0 | 0.0 | 0.045686 |  0.045686 | 0.045916 | 0.035916 | 1.006935 | 0.0 | 0.0 |  73.918192 |       0.0 |  9.091563 | 0.009977 |
    | 01.01. 19:00 |  5.6 | 21.2 | 20.2 |  0.223895 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |  6.6528 |  0.259718 | 0.096141 | 0.096141 |  5.659735 |    0.0 |  0.0 |  0.0 |  5.659735 |  0.773106 | 0.023694 |   nan | 0.060598 |   0.0777 |     0.1554 |  0.712508 |  0.016629 | 0.0 | 0.045846 |  0.062475 | 0.049468 | 0.039468 | 1.903859 | 0.0 | 0.0 |  78.841725 |  0.618179 |  9.123417 | 0.010963 |
    | 01.01. 20:00 |  2.9 | 20.4 | 19.4 |  0.099425 |  21.0 | 21.0 |      1.0 | 1.1 | 0.0 |  3.4452 |  0.115333 | 0.058839 | 0.058839 |  3.349059 |    0.0 |  0.0 |  0.0 |  3.349059 |  0.520445 | 0.015028 |   nan | 0.059165 | 0.083466 |   0.166931 |   0.46128 |  0.100569 | 0.0 | 0.046034 |  0.146603 | 0.077439 | 0.067439 | 1.941161 | 0.0 | 0.0 |  81.714476 |  0.895425 |  9.160848 | 0.018733 |
    | 01.01. 21:00 |  4.9 | 19.8 | 18.8 |  0.098454 |  20.4 | 20.4 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.114207 | 0.045942 | 0.045942 |  5.762361 |    0.0 |  0.0 |  0.0 |  5.762361 |  0.961919 | 0.012429 |   nan | 0.056743 | 0.093656 |   0.187313 |  0.905176 |  0.275044 | 0.0 | 0.046273 |  0.321317 | 0.166733 | 0.156733 | 1.954058 | 0.0 | 0.0 |  86.559232 |  1.431901 |  9.208232 | 0.043537 |
    | 01.01. 22:00 | 10.6 | 19.6 | 18.6 |  0.098128 |  20.2 | 20.2 |      1.0 | 1.1 | 0.0 | 12.5928 |  0.113828 | 0.023264 | 0.023264 | 12.546858 |    0.0 |  0.0 |  0.0 | 12.546858 |  2.350184 | 0.007038 |   nan | 0.051622 | 0.117129 |   0.234258 |  2.298561 |  0.903885 | 0.0 | 0.046627 |  0.950512 | 0.422313 | 0.412313 | 1.976736 | 0.0 | 0.0 |  96.800491 |  2.709448 |  9.278734 | 0.114531 |
    | 01.01. 23:00 |  0.1 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.1188 |   0.11307 | 0.080449 | 0.080449 |  0.095536 |    0.0 |  0.0 |  0.0 |  0.095536 |   0.02238 | 0.024367 |   nan | 0.051563 | 0.117372 |   0.234744 | -0.029183 |  0.805699 | 0.0 | 0.046981 |  0.852679 |  0.78895 |  0.77895 | 1.919551 | 0.0 | 0.0 |  96.900842 |  1.757194 |  9.349126 | 0.216375 |
    | 02.01. 00:00 |  0.7 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.8316 |   0.11307 | 0.074914 | 0.074914 |  0.751151 |    0.0 |  0.0 |  0.0 |  0.751151 |  0.176328 | 0.022832 |   nan | 0.051262 | 0.118838 |   0.237676 |  0.125066 |   0.30497 | 0.0 |  0.04734 |   0.35231 | 0.763227 | 0.753227 | 1.925086 | 0.0 | 0.0 |  97.504096 |  1.458453 |  9.420624 |  0.20923 |
    | 02.01. 01:00 |  3.0 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |   3.564 |   0.11307 | 0.057003 | 0.057003 |  3.489086 |    0.0 |  0.0 |  0.0 |  3.489086 |  0.829273 | 0.017851 |   nan | 0.049918 |  0.12549 |   0.250981 |  0.779355 |  0.292533 | 0.0 | 0.047731 |  0.340263 | 0.460826 | 0.450826 | 1.942997 | 0.0 | 0.0 | 100.195975 |  1.819784 |  9.498384 | 0.125229 |
    | 02.01. 02:00 |  2.1 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |  2.4948 |  0.112498 | 0.063115 | 0.063115 |  2.437797 |    0.0 |  0.0 |  0.0 |  2.437797 |   0.61184 | 0.020132 |   nan | 0.048989 |  0.13018 |   0.260359 |  0.562851 |  0.365199 | 0.0 | 0.048143 |  0.413342 |  0.35918 |  0.34918 | 1.936885 | 0.0 | 0.0 | 102.050789 |  1.887257 |   9.58042 | 0.096994 |
    | 02.01. 03:00 | 10.4 | 18.7 | 17.7 |  0.096652 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 | 12.3552 |  0.112116 | 0.023465 | 0.023465 | 12.292085 |    0.0 |  0.0 |  0.0 | 12.292085 |  3.200356 | 0.008153 |   nan | 0.044429 | 0.154509 |   0.309018 |  3.155927 |  1.047457 | 0.0 | 0.048675 |  1.096132 | 0.548833 | 0.538833 | 1.976535 | 0.0 | 0.0 | 111.178794 |  3.841219 |  9.686255 | 0.149676 |
    | 02.01. 04:00 |  3.5 | 18.5 | 17.5 |  0.096321 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |   4.158 |  0.111732 |  0.05308 |  0.05308 |  4.134535 |    0.0 |  0.0 |  0.0 |  4.134535 |  1.277646 | 0.018923 |   nan | 0.042982 |  0.16262 |   0.325241 |  1.234664 |  1.415468 | 0.0 | 0.049244 |  1.464713 | 1.026307 | 1.016307 |  1.94692 | 0.0 | 0.0 | 114.059742 |  3.497794 |  9.799631 | 0.282308 |
    | 02.01. 05:00 |  3.4 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |  4.0392 |  0.111348 |  0.05353 |  0.05353 |   3.98612 |    0.0 |  0.0 |  0.0 |   3.98612 |  1.296448 | 0.019537 |   nan | 0.041625 | 0.170445 |    0.34089 |  1.254823 |  1.088288 | 0.0 |  0.04985 |  1.138139 | 1.310234 | 1.300234 |  1.94647 | 0.0 | 0.0 | 116.771503 |  3.493884 |  9.920225 | 0.361176 |
    | 02.01. 06:00 |  1.2 | 18.5 | 17.5 |  0.187298 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |  1.4256 |  0.217266 | 0.135647 | 0.135647 |   1.37207 |    0.0 |  0.0 |  0.0 |   1.37207 |  0.467724 |   0.0499 |   nan | 0.041162 | 0.173069 |   0.346139 |  0.426562 |  0.792891 | 0.0 | 0.050466 |  0.843358 | 1.145204 | 1.135204 | 1.864353 | 0.0 | 0.0 |  117.66711 |  2.954486 | 10.042828 | 0.315334 |
    | 02.01. 07:00 |  0.1 | 18.8 | 17.8 |  1.264612 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  0.1188 |   1.46695 |  1.04373 |  1.04373 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.383924 |   nan | 0.041166 | 0.172063 |   0.344125 | -0.041166 |  0.439147 | 0.0 | 0.051074 |  0.490221 |  0.83039 |  0.82039 | 0.939422 | 0.0 | 0.0 | 117.324353 |   2.30211 | 10.163816 | 0.227886 |
    | 02.01. 08:00 |  0.0 | 18.8 | 17.8 |  3.045538 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |     0.0 |  3.532824 | 2.543633 | 0.939422 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.735028 |   nan | 0.041338 | 0.167131 |   0.334261 | -0.041338 |  0.238811 | 0.0 | 0.051655 |  0.290465 | 0.524306 | 0.514306 |      0.0 | 0.0 | 0.0 | 115.630662 |   1.85483 | 10.279292 | 0.142863 |
    | 02.01. 09:00 |  0.0 | 19.0 | 18.0 |  1.930758 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |     0.0 |  2.239679 | 1.612569 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.165815 |   nan | 0.042185 | 0.163898 |   0.327797 | -0.042185 |  0.135278 | 0.0 | 0.052216 |  0.187494 | 0.311973 | 0.301973 |      0.0 | 0.0 | 0.0 | 114.507032 |   1.51347 | 10.390974 | 0.083881 |
    | 02.01. 10:00 |  0.4 | 19.2 | 18.2 |  2.461001 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.4752 |  2.854761 | 1.960038 |   0.4752 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.403262 |   nan | 0.042746 | 0.160027 |   0.320053 | -0.042746 |  0.078912 | 0.0 | 0.052755 |  0.131667 |  0.19797 |  0.18797 |      0.0 | 0.0 | 0.0 | 113.146516 |  1.231784 | 10.498246 | 0.052214 |
    | 02.01. 11:00 |  0.1 | 19.3 | 18.3 |  6.215945 |  19.9 | 19.9 |      1.0 | 1.1 | 0.0 |  0.1188 |  7.210496 | 5.130246 |   0.1188 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.629327 |   nan | 0.043427 | 0.150044 |   0.300088 | -0.043427 |  0.050702 | 0.0 | 0.053241 |  0.103943 | 0.137912 | 0.127912 |      0.0 | 0.0 | 0.0 | 109.560616 |  0.987612 | 10.595049 | 0.035531 |
    | 02.01. 12:00 |  3.6 | 19.0 | 18.0 |  3.374783 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |  4.2768 |  3.914748 | 1.837796 | 1.837796 |    2.2768 |    0.0 |  0.0 |  0.0 |    2.2768 |  0.683241 | 0.638626 |   nan | 0.044423 | 0.152794 |   0.305588 |  0.638818 |  0.063517 | 0.0 | 0.053739 |  0.117256 | 0.113063 | 0.103063 | 0.162204 | 0.0 | 0.0 | 110.559972 |  1.410119 | 10.694103 | 0.028628 |
    | 02.01. 13:00 |  5.9 | 18.8 | 17.8 |  8.821555 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  7.0092 | 10.233004 | 3.655358 |      2.0 |  5.171404 |    0.0 |  0.0 |  0.0 |  5.171404 |  1.580317 | 2.132116 |   nan | 0.042924 | 0.156973 |   0.313947 |  1.537393 |  0.280085 | 0.0 | 0.054255 |  0.334341 | 0.162539 | 0.152539 |      0.0 | 0.0 | 0.0 | 112.061866 |  2.510453 | 10.796821 | 0.042372 |
    | 02.01. 14:00 |  1.1 | 18.7 | 17.7 |  4.046025 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 |  1.3068 |  4.693389 | 2.965278 |   1.3068 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.868067 |   nan | 0.043969 | 0.151905 |   0.303809 | -0.043969 |  0.384322 | 0.0 | 0.054744 |  0.439066 | 0.309372 | 0.299372 |      0.0 | 0.0 | 0.0 | 110.237768 |  1.930258 | 10.893982 | 0.083159 |
    | 02.01. 15:00 | 20.7 | 17.8 | 16.8 |  2.110757 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 | 24.5916 |  2.448478 |  0.15074 |  0.15074 |   22.5916 |    0.0 |  0.0 |  0.0 |   22.5916 |  6.863535 | 0.059355 |   nan | 0.037017 | 0.198272 |   0.396544 |  6.826517 |  2.037496 | 0.0 | 0.055461 |  2.092957 | 0.783325 | 0.773325 |  1.84926 | 0.0 | 0.0 | 125.943496 |  6.521007 | 11.036793 | 0.214812 |
    | 02.01. 16:00 | 37.9 | 17.4 | 16.4 |  2.239257 |  18.0 | 18.0 |      1.0 | 1.1 | 0.0 | 45.0252 |  2.597538 | 0.020724 | 0.020724 |  44.87446 |    0.0 |  0.0 |  0.0 |  44.87446 | 17.794702 | 0.009912 |   nan | 0.023488 | 0.292753 |   0.585507 | 17.771214 |  9.477037 | 0.0 | 0.056648 |  9.533685 | 3.378921 | 3.368921 | 1.979276 | 0.0 | 0.0 |  153.03683 | 14.522431 | 11.272899 | 0.935811 |
    | 02.01. 17:00 |  8.2 | 17.3 | 16.3 |  2.877848 |  17.9 | 17.9 |      1.0 | 1.1 | 0.0 |  9.7416 |  3.338304 | 0.907373 | 0.907373 |  9.720876 |    0.0 |  0.0 |  0.0 |  9.720876 |  5.691639 | 0.445428 |   nan | 0.021467 | 0.306709 |   0.613419 |  5.670172 |  8.550769 | 0.0 | 0.057898 |  8.608667 |  7.67463 |  7.66463 | 1.092627 | 0.0 | 0.0 | 156.642106 | 11.335124 |  11.52171 | 2.129064 |
    | 02.01. 18:00 |  3.6 | 16.8 | 15.8 |  1.591452 |  17.4 | 17.4 |      1.0 | 1.1 | 0.0 |  4.2768 |  1.846084 | 0.866652 | 0.866652 |  3.369427 |    0.0 |  0.0 |  0.0 |  3.369427 |  2.066869 | 0.427817 |   nan | 0.021028 | 0.310227 |   0.620455 |  2.045842 |  4.140784 | 0.0 |  0.05916 |  4.199943 |  7.83451 |  7.82451 | 1.133348 | 0.0 | 0.0 | 157.537874 |  8.929955 | 11.772778 | 2.173475 |
    | 02.01. 19:00 |  7.5 | 16.5 | 15.5 |  0.291604 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |    8.91 |  0.338261 | 0.099914 | 0.099914 |  8.043348 |    0.0 |  0.0 |  0.0 |  8.043348 |  4.990532 | 0.049957 |   nan | 0.019705 | 0.322246 |   0.644491 |  4.970827 |  3.415715 | 0.0 | 0.060475 |   3.47619 | 5.018826 | 5.008826 | 1.900086 | 0.0 | 0.0 | 160.560437 | 10.162822 | 12.034548 |  1.39134 |
    | 02.01. 20:00 | 18.5 | 16.3 | 15.3 |  0.092622 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  21.978 |  0.107442 |  0.00859 |  0.00859 | 21.878086 |    0.0 |  0.0 |  0.0 | 21.878086 | 14.100237 | 0.004295 |   nan | 0.015831 | 0.354271 |   0.708542 | 14.084406 |  7.923725 | 0.0 | 0.061944 |  7.985669 |  4.63913 |  4.62913 |  1.99141 | 0.0 | 0.0 | 168.349822 | 15.969232 | 12.326875 |  1.28587 |
    | 02.01. 21:00 | 15.4 | 16.2 | 15.2 |  0.092451 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 | 18.2952 |  0.107243 | 0.012392 | 0.012392 |  18.28661 |    0.0 |  0.0 |  0.0 |  18.28661 | 12.956823 | 0.006196 |   nan |  0.01316 | 0.377088 |   0.754176 | 12.943663 | 11.304212 | 0.0 |  0.06352 | 11.367732 | 7.735132 | 7.725132 | 1.987608 | 0.0 | 0.0 | 173.686572 | 17.231595 | 12.640443 |  2.14587 |
    | 02.01. 22:00 |  6.3 | 15.5 | 14.5 |  0.091248 |  16.1 | 16.1 |      1.0 | 1.1 | 0.0 |  7.4844 |  0.105848 | 0.036055 | 0.036055 |  7.472008 |    0.0 |  0.0 |  0.0 |  7.472008 |  5.635206 | 0.018028 |   nan | 0.012238 |  0.38508 |   0.770161 |  5.622968 |  8.161988 | 0.0 | 0.065128 |  8.227115 | 9.918248 | 9.908248 | 1.963945 | 0.0 | 0.0 | 175.517585 | 14.307494 | 12.960395 | 2.752291 |
    | 02.01. 23:00 |  1.9 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  2.2572 |  0.104032 | 0.059768 | 0.059768 |  2.221145 |    0.0 |  0.0 |  0.0 |  2.221145 |  1.710638 | 0.029884 |   nan | 0.011986 | 0.387245 |    0.77449 |  1.698652 |  4.333944 | 0.0 | 0.066738 |  4.400682 | 8.074712 | 8.064712 | 1.940232 | 0.0 | 0.0 | 176.010193 | 11.284958 | 13.280902 | 2.240198 |
    | 03.01. 00:00 |  4.9 | 14.7 | 13.7 |  0.089858 |  15.3 | 15.3 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.104235 | 0.041931 | 0.041931 |  5.761432 |    0.0 |  0.0 |  0.0 |  5.761432 |  4.462169 | 0.020966 |   nan | 0.011345 |  0.39294 |   0.785881 |  4.450824 |  3.332947 | 0.0 | 0.068369 |  3.401316 | 5.028919 | 5.018919 | 1.958069 | 0.0 | 0.0 | 177.299835 | 12.009895 | 13.605473 | 1.394144 |
    | 03.01. 01:00 |  2.7 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  3.2076 |  0.104032 |  0.05435 |  0.05435 |  3.165669 |    0.0 |  0.0 |  0.0 |  3.165669 |  2.487838 | 0.027175 |   nan | 0.011011 | 0.395879 |   0.791757 |  2.476827 |   3.05638 | 0.0 | 0.070007 |  3.126387 | 3.562302 | 3.552302 |  1.94565 | 0.0 | 0.0 | 177.961502 | 11.034464 | 13.931345 |  0.98675 |
    | 03.01. 02:00 |  0.5 | 14.1 | 13.1 |  0.088805 |  14.7 | 14.7 |      1.0 | 1.1 | 0.0 |   0.594 |  0.103014 | 0.069893 | 0.069893 |   0.53965 |    0.0 |  0.0 |  0.0 |   0.53965 |  0.427272 | 0.034946 |   nan | 0.010963 | 0.396272 |   0.792544 |  0.416309 |  2.001337 | 0.0 | 0.071638 |  2.072975 | 2.953391 | 2.943391 | 1.930107 | 0.0 | 0.0 | 178.049897 |  9.053164 | 14.255979 | 0.817608 |
    | 03.01. 03:00 |  0.2 | 14.3 | 13.3 |  0.089157 |  14.9 | 14.9 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.103422 | 0.072716 | 0.072716 |  0.167707 |    0.0 |  0.0 |  0.0 |  0.167707 |  0.132916 | 0.036358 |   nan | 0.010958 | 0.396314 |   0.792628 |  0.121958 |  1.154152 | 0.0 | 0.073261 |  1.227413 | 2.119164 | 2.109164 | 1.927284 | 0.0 | 0.0 | 178.059289 |  7.624656 | 14.579032 | 0.585879 |
    | 03.01. 04:00 |  0.5 | 14.9 | 13.9 |  0.090207 |  15.5 | 15.5 |      1.0 | 1.1 | 0.0 |   0.594 |   0.10464 | 0.070996 | 0.070996 |  0.521284 |    0.0 |  0.0 |  0.0 |  0.521284 |  0.413185 | 0.035498 |   nan | 0.010916 | 0.396686 |   0.793371 |  0.402268 |  0.759428 | 0.0 | 0.074879 |  0.834307 | 1.327959 | 1.317959 | 1.929004 | 0.0 | 0.0 | 178.142807 |  6.870811 | 14.900839 |   0.3661 |
    | 03.01. 05:00 |  2.4 | 15.7 | 14.7 |  0.091593 |  16.3 | 16.3 |      1.0 | 1.1 | 0.0 |  2.8512 |  0.106248 | 0.057521 | 0.057521 |  2.780204 |    0.0 |  0.0 |  0.0 |  2.780204 |  2.205735 | 0.028761 |   nan | 0.010641 | 0.399167 |   0.798335 |  2.195093 |   0.80239 | 0.0 |   0.0765 |   0.87889 | 0.931571 | 0.921571 | 1.942479 | 0.0 | 0.0 | 178.699157 |  7.864347 | 15.223506 | 0.255992 |
    | 03.01. 06:00 |  0.4 | 16.0 | 15.0 |  0.154861 |  16.6 | 16.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  0.179639 | 0.123337 | 0.123337 |  0.417679 |    0.0 |  0.0 |  0.0 |  0.417679 |  0.333448 | 0.061669 |   nan | 0.010608 | 0.399316 |   0.798631 |  0.322839 |  0.800248 | 0.0 | 0.078114 |  0.878362 | 0.868865 | 0.858865 | 1.876663 | 0.0 | 0.0 | 178.732328 |  6.987622 | 15.544708 | 0.238574 |
    | 03.01. 07:00 |  0.2 | 16.7 | 15.7 |  0.470369 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.545628 | 0.383628 | 0.383628 |  0.114263 |    0.0 |  0.0 |  0.0 |  0.114263 |  0.091254 | 0.191814 |   nan | 0.010622 | 0.398609 |   0.797218 |  0.080631 |  0.553214 | 0.0 | 0.079717 |   0.63293 | 0.823939 | 0.813939 | 1.616372 | 0.0 | 0.0 | 178.574145 |  6.116431 |   15.8636 | 0.226094 |
    | 03.01. 08:00 |  0.0 | 17.1 | 16.1 |  1.173726 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  1.361522 | 0.980296 | 0.980296 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.490148 |   nan | 0.010713 | 0.396472 |   0.792943 | -0.010713 |  0.375567 | 0.0 |   0.0813 |  0.456868 | 0.648346 | 0.638346 | 0.636076 | 0.0 | 0.0 |  178.09471 |  5.333679 | 16.178771 | 0.177318 |
    | 03.01. 09:00 |  0.0 | 16.2 | 15.2 |  4.202296 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 |     0.0 |  4.874663 | 3.509758 | 0.636076 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  3.19172 |   nan | 0.010953 | 0.382436 |   0.764872 | -0.010953 |  0.278561 | 0.0 | 0.082806 |  0.361367 |  0.47477 |  0.46477 |      0.0 | 0.0 | 0.0 | 174.913943 |   4.66173 | 16.478401 | 0.129103 |
    | 03.01. 10:00 |  0.3 | 15.9 | 14.9 |  4.359715 |  16.5 | 16.5 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.057269 | 3.513746 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.335546 |   nan | 0.012543 | 0.368043 |   0.736086 | -0.012543 |  0.208651 | 0.0 | 0.084232 |  0.292883 | 0.367371 | 0.357371 |      0.0 | 0.0 | 0.0 | 171.590941 |  4.072493 | 16.762212 |  0.09927 |
    | 03.01. 11:00 |  2.6 | 16.3 | 15.3 |  5.305753 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  3.0888 |  6.154673 | 3.253813 |      2.0 |    1.0888 |    0.0 |  0.0 |  0.0 |    1.0888 |  0.801451 | 2.253813 |   nan | 0.014061 | 0.359715 |   0.719431 |   0.78739 |  0.198136 | 0.0 |  0.08561 |  0.283746 | 0.306071 | 0.296071 |      0.0 | 0.0 | 0.0 | 169.638537 |  4.302031 | 17.036318 | 0.082242 |
    | 03.01. 12:00 |  0.7 | 16.3 | 15.3 |  5.376027 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  0.8316 |  6.236191 | 4.131769 |   0.8316 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.715969 |   nan | 0.015181 | 0.344192 |   0.688383 | -0.015181 |  0.199364 | 0.0 | 0.086903 |  0.286266 | 0.286337 | 0.276337 |      0.0 | 0.0 | 0.0 | 165.937749 |  3.743294 | 17.293607 |  0.07676 |
    | 03.01. 13:00 |  0.3 | 16.4 | 15.4 |  4.658915 |  17.0 | 17.0 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.404341 | 3.754888 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.576688 |   nan | 0.017031 | 0.329583 |   0.659166 | -0.017031 |  0.149065 | 0.0 | 0.088116 |  0.237181 | 0.274798 | 0.264798 |      0.0 | 0.0 | 0.0 | 162.378092 |  3.247615 | 17.535074 | 0.073555 |
    | 03.01. 14:00 |  0.3 | 16.5 | 15.5 |  7.789594 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |  0.3564 |  9.035929 | 6.278083 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 6.099883 |   nan | 0.018811 | 0.305359 |   0.610719 | -0.018811 |  0.121494 | 0.0 | 0.089202 |  0.210696 | 0.242203 | 0.232203 |      0.0 | 0.0 | 0.0 |  156.29702 |  2.801951 | 17.751232 | 0.064501 |
    | 03.01. 15:00 |  0.0 | 18.4 | 17.4 |  4.851567 |  19.0 | 19.0 |      1.0 | 1.1 | 0.0 |     0.0 |  5.627818 | 4.052029 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.958804 |   nan | 0.021851 |  0.29017 |    0.58034 | -0.021851 |  0.090079 | 0.0 | 0.090207 |  0.180286 | 0.209824 | 0.199824 |      0.0 | 0.0 | 0.0 | 152.360068 |   2.39985 | 17.951194 | 0.055507 |
    | 03.01. 16:00 |  0.0 | 18.3 | 17.3 |   5.30692 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  6.156027 |  4.43234 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.221357 |   nan |  0.02382 | 0.274402 |   0.548803 |  -0.02382 |  0.066087 | 0.0 | 0.091128 |  0.157215 | 0.181917 | 0.171917 |      0.0 | 0.0 | 0.0 | 148.162531 |  2.035542 | 18.134468 | 0.047755 |
    | 03.01. 17:00 |  0.0 | 18.1 | 17.1 |  3.286036 |  18.7 | 18.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.811802 | 2.744497 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.541892 |   nan | 0.025919 | 0.265161 |   0.530323 | -0.025919 |  0.043836 | 0.0 | 0.091998 |  0.135834 |  0.15759 |  0.14759 |      0.0 | 0.0 | 0.0 | 145.646557 |  1.700626 | 18.307631 | 0.040997 |
    | 03.01. 18:00 |  0.0 | 16.7 | 15.7 |  1.506216 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |     0.0 |  1.747211 | 1.257992 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.145352 |   nan | 0.027177 | 0.261106 |   0.522211 | -0.027177 |  0.025957 | 0.0 | 0.092844 |  0.118801 |   0.1368 |   0.1268 |      0.0 | 0.0 | 0.0 | 144.528382 |  1.386387 | 18.475893 | 0.035222 |
    | 03.01. 19:00 |  0.0 | 15.2 | 14.2 |  0.274762 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.318724 | 0.229481 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.207331 |   nan | 0.027736 | 0.260457 |   0.520914 | -0.027736 |  0.013472 | 0.0 | 0.093682 |  0.107154 | 0.119998 | 0.109998 |      0.0 | 0.0 | 0.0 | 144.348787 |  1.084722 | 18.642669 | 0.030555 |
    | 03.01. 20:00 |  0.0 | 13.4 | 12.4 |  0.087565 |  14.0 | 14.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.101575 | 0.073134 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.065993 |   nan | 0.027826 | 0.260319 |   0.520639 | -0.027826 |   0.00595 | 0.0 | 0.094515 |  0.100465 | 0.108256 | 0.098256 |      0.0 | 0.0 | 0.0 |  144.31062 |  0.790627 | 18.808473 | 0.027293 |
    | 03.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.064624 |   nan | 0.027845 | 0.260187 |   0.520374 | -0.027845 |  0.001991 | 0.0 | 0.095343 |  0.097335 | 0.101256 | 0.091256 |      0.0 | 0.0 | 0.0 |  144.27384 |  0.500604 | 18.973317 | 0.025349 |
    | 03.01. 22:00 |  0.0 | 11.6 | 10.6 |  0.084317 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |     0.0 |  0.097808 | 0.070422 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063512 |   nan | 0.027863 | 0.260058 |   0.520116 | -0.027863 |   0.00037 | 0.0 | 0.096167 |  0.096537 | 0.097853 | 0.087853 |      0.0 | 0.0 | 0.0 | 144.238191 |  0.212312 | 19.137208 | 0.024404 |
    | 03.01. 23:00 |  0.0 | 11.0 | 10.0 |  0.083215 |  11.6 | 11.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096529 | 0.069501 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.062667 |   nan | 0.027881 | 0.184419 |   0.519866 | -0.027881 |  0.000012 | 0.0 | 0.096608 |   0.09662 | 0.096733 | 0.086733 |      0.0 | 0.0 | 0.0 | 144.203406 |       0.0 | 19.225019 | 0.024092 |
    | 04.01. 00:00 |  0.0 | 10.5 |  9.5 |  0.082289 |  11.1 | 11.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.095455 | 0.068728 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.061942 |   nan |      0.0 |      0.0 |   0.519419 |       0.0 |       0.0 | 0.0 | 0.096125 |  0.096125 | 0.096492 | 0.086492 |      0.0 | 0.0 | 0.0 | 144.141463 |       0.0 | 19.128894 | 0.024026 |
    | 04.01. 01:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063579 |   nan |      0.0 |      0.0 |   0.518961 |       0.0 |       0.0 | 0.0 | 0.095644 |  0.095644 | 0.096128 | 0.086128 |      0.0 | 0.0 | 0.0 | 144.077884 |       0.0 |  19.03325 | 0.023925 |
    | 04.01. 02:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063825 |   nan |      0.0 |      0.0 |   0.518501 |       0.0 |       0.0 | 0.0 | 0.095166 |  0.095166 | 0.095645 | 0.085645 |      0.0 | 0.0 | 0.0 | 144.014059 |       0.0 | 18.938083 |  0.02379 |
    | 04.01. 03:00 |  1.3 | 11.2 | 10.2 |  0.083584 |  11.8 | 11.8 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.096957 | 0.059819 | 0.059819 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.026921 |   nan |      0.0 |      0.0 |   0.518307 |       0.0 |       0.0 | 0.0 |  0.09469 |   0.09469 | 0.095167 | 0.085167 | 1.484581 | 0.0 | 0.0 | 143.987137 |       0.0 | 18.843393 | 0.023657 |
    | 04.01. 04:00 |  0.0 | 11.1 | 10.1 |    0.0834 |  11.7 | 11.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096744 | 0.069656 | 0.069656 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.031342 |   nan |      0.0 |      0.0 |   0.518082 |       0.0 |       0.0 | 0.0 | 0.094217 |  0.094217 | 0.094691 | 0.084691 | 1.414925 | 0.0 | 0.0 | 143.955795 |       0.0 | 18.749176 | 0.023525 |
    | 04.01. 05:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 | 0.070878 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.031885 |   nan |      0.0 |      0.0 |   0.517852 |       0.0 |       0.0 | 0.0 | 0.093746 |  0.093746 | 0.094217 | 0.084217 | 1.344047 | 0.0 | 0.0 |  143.92391 |       0.0 |  18.65543 | 0.023394 |
    | 04.01. 06:00 |  0.0 | 12.2 | 11.2 |  0.310229 |  12.8 | 12.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.359866 | 0.259103 | 0.259103 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.116535 |   nan |      0.0 |      0.0 |   0.517014 |       0.0 |       0.0 | 0.0 | 0.093277 |  0.093277 | 0.093746 | 0.083746 | 1.084943 | 0.0 | 0.0 | 143.807375 |       0.0 | 18.562153 | 0.023263 |
    | 04.01. 07:00 |  0.7 | 11.8 | 10.8 |  1.391958 |  12.4 | 12.4 |      1.0 | 1.1 | 0.0 |  0.8316 |  1.614671 | 1.069795 | 1.069795 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.480764 |   nan |      0.0 |      0.0 |   0.513563 |       0.0 |       0.0 | 0.0 | 0.092811 |  0.092811 | 0.093278 | 0.083278 | 0.846748 | 0.0 | 0.0 | 143.326611 |       0.0 | 18.469342 | 0.023133 |
    | 04.01. 08:00 |  0.4 | 11.4 | 10.4 |  3.195876 |  12.0 | 12.0 |      1.0 | 1.1 | 0.0 |  0.4752 |  3.707216 | 2.545322 | 1.321948 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.751726 |   nan |      0.0 |      0.0 |   0.501086 |       0.0 |       0.0 | 0.0 | 0.092347 |  0.092347 | 0.092811 | 0.082811 |      0.0 | 0.0 | 0.0 | 141.574885 |       0.0 | 18.376995 | 0.023003 |
    | 04.01. 09:00 |  0.1 | 11.6 | 10.6 |  5.191651 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |  0.1188 |  6.022315 | 4.284859 |   0.1188 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.791428 |   nan |      0.0 |      0.0 |   0.474607 |       0.0 |       0.0 | 0.0 | 0.091885 |  0.091885 | 0.092347 | 0.082347 |      0.0 | 0.0 | 0.0 | 137.783457 |       0.0 |  18.28511 | 0.022874 |
    | 04.01. 10:00 |  0.4 | 13.0 | 12.0 |  7.155036 |  13.6 | 13.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  8.299842 | 5.698554 |   0.4752 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  4.90729 |   nan |      0.0 |      0.0 |   0.441402 |       0.0 |       0.0 | 0.0 | 0.091426 |  0.091426 | 0.091885 | 0.081885 |      0.0 | 0.0 | 0.0 | 132.876167 |       0.0 | 18.193685 | 0.022746 |
    | 04.01. 11:00 |  0.0 | 17.1 | 16.1 |  8.391432 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  9.734061 | 7.008524 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.820411 |   nan |      0.0 |      0.0 |   0.403579 |       0.0 |       0.0 | 0.0 | 0.090968 |  0.090968 | 0.091426 | 0.081426 |      0.0 | 0.0 | 0.0 | 127.055756 |       0.0 | 18.102717 | 0.022618 |
    | 04.01. 12:00 |  0.0 | 18.2 | 17.2 |  8.391286 |  18.8 | 18.8 |      1.0 | 1.1 | 0.0 |     0.0 |  9.733892 | 7.008402 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.565361 |   nan |      0.0 |      0.0 |   0.368998 |       0.0 |       0.0 | 0.0 | 0.090514 |  0.090514 | 0.090969 | 0.080969 |      0.0 | 0.0 | 0.0 | 121.490395 |       0.0 | 18.012203 | 0.022491 |
    | 04.01. 13:00 |  0.0 | 22.4 | 21.4 | 10.715238 |  23.0 | 23.0 |      1.0 | 1.1 | 0.0 |     0.0 | 12.429676 | 8.949367 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 6.795388 |   nan |      0.0 |      0.0 |   0.328874 |       0.0 |       0.0 | 0.0 | 0.090061 |  0.090061 | 0.090514 | 0.080514 |      0.0 | 0.0 | 0.0 | 114.695007 |       0.0 | 17.922142 | 0.022365 |
    | 04.01. 14:00 |  0.0 | 21.4 | 20.4 |  9.383394 |  22.0 | 22.0 |      1.0 | 1.1 | 0.0 |     0.0 | 10.884737 | 7.837011 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.617912 |   nan |      0.0 |      0.0 |   0.297445 |       0.0 |       0.0 | 0.0 | 0.089611 |  0.089611 | 0.090062 | 0.080062 |      0.0 | 0.0 | 0.0 | 109.077094 |       0.0 | 17.832531 | 0.022239 |
    | 04.01. 15:00 |  0.0 | 21.8 | 20.8 |  7.861915 |  22.4 | 22.4 |      1.0 | 1.1 | 0.0 |     0.0 |  9.119821 | 6.566271 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.476436 |   nan |      0.0 |      0.0 |   0.273532 |       0.0 |       0.0 | 0.0 | 0.089163 |  0.089163 | 0.089611 | 0.079611 |      0.0 | 0.0 | 0.0 | 104.600658 |       0.0 | 17.743369 | 0.022114 |
    | 04.01. 16:00 |  0.0 | 22.2 | 21.2 |  6.298329 |  22.8 | 22.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.306062 | 5.260364 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.438985 |   nan |      0.0 |      0.0 |   0.255842 |       0.0 |       0.0 | 0.0 | 0.088717 |  0.088717 | 0.089163 | 0.079163 |      0.0 | 0.0 | 0.0 | 101.161673 |       0.0 | 17.654652 |  0.02199 |
    | 04.01. 17:00 |  0.0 | 20.1 | 19.1 |  2.948416 |  20.7 | 20.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.420163 | 2.462517 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.556952 |   nan |      0.0 |      0.0 |   0.248028 |       0.0 |       0.0 | 0.0 | 0.088273 |  0.088273 | 0.088717 | 0.078717 |      0.0 | 0.0 | 0.0 |  99.604721 |       0.0 | 17.566378 | 0.021866 |
    | 04.01. 18:00 |  0.0 | 17.8 | 16.8 |  1.309232 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 |     0.0 |  1.518709 | 1.093471 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.680718 |   nan |      0.0 |      0.0 |   0.244649 |       0.0 |       0.0 | 0.0 | 0.087832 |  0.087832 | 0.088274 | 0.078274 |      0.0 | 0.0 | 0.0 |  98.924003 |       0.0 | 17.478547 | 0.021743 |
    | 04.01. 19:00 |  0.0 | 15.2 | 14.2 |   0.32955 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.382278 |  0.27524 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.170174 |   nan |      0.0 |      0.0 |   0.243808 |       0.0 |       0.0 | 0.0 | 0.087393 |  0.087393 | 0.087832 | 0.077832 |      0.0 | 0.0 | 0.0 |  98.753829 |       0.0 | 17.391154 |  0.02162 |
    | 04.01. 20:00 |  0.0 | 14.5 | 13.5 |  0.089508 |  15.1 | 15.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.103829 | 0.074757 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.046141 |   nan |      0.0 |      0.0 |    0.24358 |       0.0 |       0.0 | 0.0 | 0.086956 |  0.086956 | 0.087393 | 0.077393 |      0.0 | 0.0 | 0.0 |  98.707688 |       0.0 | 17.304198 | 0.021498 |
    | 04.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.044194 |   nan |      0.0 |      0.0 |   0.243362 |       0.0 |       0.0 | 0.0 | 0.086521 |  0.086521 | 0.086956 | 0.076956 |      0.0 | 0.0 | 0.0 |  98.663494 |       0.0 | 17.217677 | 0.021377 |
    | 04.01. 22:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.043519 |   nan |      0.0 |      0.0 |   0.243147 |       0.0 |       0.0 | 0.0 | 0.086088 |  0.086088 | 0.086521 | 0.076521 |      0.0 | 0.0 | 0.0 |  98.619975 |       0.0 | 17.131589 | 0.021256 |
    | 04.01. 23:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.043688 |   nan |      0.0 |      0.0 |   0.242932 |       0.0 |       0.0 | 0.0 | 0.085658 |  0.085658 | 0.086089 | 0.076089 |      0.0 | 0.0 | 0.0 |  98.576287 |       0.0 | 17.045931 | 0.021136 |

    .. raw:: html

        <iframe
            src="hland_v1_ex2.html"
            width="100%"
            height="930px"
            frameborder=0
        ></iframe>

    .. _hland_v1_ex3:

    **Example 3**

    The next example is supposed to demonstrate that one should be
    careful when reducing the value of |RecStep| in order to save
    computation times.  Setting |RecStep| to one, which is the lowest
    possible value, results in low accuracies in the calculation of |Q0|.
    This can easily be seen when comparing the |Q0| graph of the last example
    and the |Q0| graph of this example.  Obviously, the |Q0| graph of
    this example is (much more) wrong, as its maximum peak is largely
    above the maximum peak of |R|, which is physically impossible:

    >>> recstep(1)
    >>> test('hland_v1_ex3')
    |         date |    p |    t |   tn |       epn | tmean |   tc | fracrain | rfc | sfc |      pc |        ep |      epc |       ei |        tf | glmelt | melt | refr |       in_ |         r |       ea | cfpot |       cf |     perc | contriarea |      inuz |        q0 |  el |       q1 |      inuh |     outuh |        qt |       ic |  sp |  wc |         sm |       uz |        lz |   outlet |
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. 00:00 |  0.0 | 21.2 | 20.2 |  0.100707 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |     0.0 |   0.11682 |  0.08411 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.052569 |   nan |      0.0 |      0.0 |   0.249737 |       0.0 |       0.0 | 0.0 |     0.05 |      0.05 |  0.061111 |  0.051111 |      0.0 | 0.0 | 0.0 |  99.947431 |      0.0 |      9.95 | 0.014198 |
    | 01.01. 01:00 |  0.0 | 19.4 | 18.4 |  0.097801 |  20.0 | 20.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.113449 | 0.081683 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.051025 |   nan |      0.0 |      0.0 |   0.249482 |       0.0 |       0.0 | 0.0 |  0.04975 |   0.04975 |  0.088833 |  0.078833 |      0.0 | 0.0 | 0.0 |  99.896406 |      0.0 |   9.90025 | 0.021898 |
    | 01.01. 02:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.050572 |   nan |      0.0 |      0.0 |    0.24923 |       0.0 |       0.0 | 0.0 | 0.049501 |  0.049501 |   0.04975 |   0.03975 |      0.0 | 0.0 | 0.0 |  99.845834 |      0.0 |  9.850749 | 0.011042 |
    | 01.01. 03:00 |  0.0 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  0.111348 | 0.080171 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.05003 |   nan |      0.0 |      0.0 |    0.24898 |       0.0 |       0.0 | 0.0 | 0.049254 |  0.049254 |  0.049502 |  0.039502 |      0.0 | 0.0 | 0.0 |  99.795804 |      0.0 |  9.801495 | 0.010973 |
    | 01.01. 04:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.050521 |   nan |      0.0 |      0.0 |   0.248728 |       0.0 |       0.0 | 0.0 | 0.049007 |  0.049007 |  0.049254 |  0.039254 |      0.0 | 0.0 | 0.0 |  99.745284 |      0.0 |  9.752488 | 0.010904 |
    | 01.01. 05:00 |  0.0 | 22.5 | 21.5 |  0.102761 |  23.1 | 23.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.119203 | 0.085826 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.053505 |   nan |      0.0 |      0.0 |   0.248461 |       0.0 |       0.0 | 0.0 | 0.048762 |  0.048762 |  0.049008 |  0.039008 |      0.0 | 0.0 | 0.0 |  99.691779 |      0.0 |  9.703725 | 0.010835 |
    | 01.01. 06:00 |  0.0 | 25.1 | 24.1 |  0.291908 |  25.7 | 25.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.338613 | 0.243802 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.151906 |   nan |      0.0 |      0.0 |   0.247705 |       0.0 |       0.0 | 0.0 | 0.048519 |  0.048519 |  0.048763 |  0.038763 |      0.0 | 0.0 | 0.0 |  99.539873 |      0.0 |  9.655206 | 0.010767 |
    | 01.01. 07:00 |  0.0 | 28.3 | 27.3 |  1.932875 |  28.9 | 28.9 |      1.0 | 1.1 | 0.0 |     0.0 |  2.242135 | 1.614337 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.004318 |   nan |      0.0 |      0.0 |   0.242731 |       0.0 |       0.0 | 0.0 | 0.048276 |  0.048276 |  0.048519 |  0.038519 |      0.0 | 0.0 | 0.0 |  98.535555 |      0.0 |   9.60693 |   0.0107 |
    | 01.01. 08:00 |  0.0 | 27.8 | 26.8 |  4.369536 |  28.4 | 28.4 |      1.0 | 1.1 | 0.0 |     0.0 |  5.068662 | 3.649436 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.247495 |   nan |      0.0 |      0.0 |   0.231785 |       0.0 |       0.0 | 0.0 | 0.048035 |  0.048035 |  0.048276 |  0.038276 |      0.0 | 0.0 | 0.0 |  96.288059 |      0.0 |  9.558896 | 0.010632 |
    | 01.01. 09:00 |  0.0 | 31.4 | 30.4 |  7.317556 |  32.0 | 32.0 |      1.0 | 1.1 | 0.0 |     0.0 |  8.488365 | 6.111623 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.677977 |   nan |      0.0 |      0.0 |   0.214416 |       0.0 |       0.0 | 0.0 | 0.047794 |  0.047794 |  0.048035 |  0.038035 |      0.0 | 0.0 | 0.0 |  92.610082 |      0.0 |  9.511101 | 0.010565 |
    | 01.01. 10:00 |  0.0 | 32.2 | 31.2 |  8.264362 |  32.8 | 32.8 |      1.0 | 1.1 | 0.0 |     0.0 |   9.58666 | 6.902395 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.995196 |   nan |      0.0 |      0.0 |   0.196315 |       0.0 |       0.0 | 0.0 | 0.047556 |  0.047556 |  0.047795 |  0.037795 |      0.0 | 0.0 | 0.0 |  88.614886 |      0.0 |  9.463546 | 0.010499 |
    | 01.01. 11:00 |  0.0 | 35.2 | 34.2 |  9.369867 |  35.8 | 35.8 |      1.0 | 1.1 | 0.0 |     0.0 | 10.869046 | 7.825713 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.334217 |   nan |      0.0 |      0.0 |   0.177581 |       0.0 |       0.0 | 0.0 | 0.047318 |  0.047318 |  0.047556 |  0.037556 |      0.0 | 0.0 | 0.0 |   84.28067 |      0.0 |  9.416228 | 0.010432 |
    | 01.01. 12:00 |  0.0 | 37.1 | 36.1 |  5.126178 |  37.7 | 37.7 |      1.0 | 1.1 | 0.0 |     0.0 |  5.946366 | 4.281384 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.255237 |   nan |      0.0 |      0.0 |   0.168204 |       0.0 |       0.0 | 0.0 | 0.047081 |  0.047081 |  0.047318 |  0.037318 |      0.0 | 0.0 | 0.0 |  82.025433 |      0.0 |  9.369147 | 0.010366 |
    | 01.01. 13:00 |  0.0 | 31.2 | 30.2 |   6.62503 |  31.8 | 31.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.685035 | 5.533225 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.836657 |   nan |      0.0 |      0.0 |   0.156772 |       0.0 |       0.0 | 0.0 | 0.046846 |  0.046846 |  0.047081 |  0.037081 |      0.0 | 0.0 | 0.0 |  79.188775 |      0.0 |  9.322301 |   0.0103 |
    | 01.01. 14:00 |  0.0 | 24.3 | 23.3 |  7.397619 |  24.9 | 24.9 |      1.0 | 1.1 | 0.0 |     0.0 |  8.581238 | 6.178491 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  3.05792 |   nan |      0.0 |      0.0 |   0.144898 |       0.0 |       0.0 | 0.0 | 0.046612 |  0.046612 |  0.046846 |  0.036846 |      0.0 | 0.0 | 0.0 |  76.130856 |      0.0 |   9.27569 | 0.010235 |
    | 01.01. 15:00 |  0.2 | 25.4 | 24.4 |   2.39151 |  26.0 | 26.0 |      1.0 | 1.1 | 0.0 |  0.2376 |  2.774152 | 1.950491 |   0.2376 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.928078 |   nan |      0.0 |      0.0 |   0.141386 |       0.0 |       0.0 | 0.0 | 0.046378 |  0.046378 |  0.046612 |  0.036612 |      0.0 | 0.0 | 0.0 |  75.202777 |      0.0 |  9.229311 |  0.01017 |
    | 01.01. 16:00 |  0.0 | 25.9 | 24.9 |  1.829834 |  26.5 | 26.5 |      1.0 | 1.1 | 0.0 |     0.0 |  2.122607 | 1.528277 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.718317 |   nan |      0.0 |      0.0 |   0.138698 |       0.0 |       0.0 | 0.0 | 0.046147 |  0.046147 |  0.046379 |  0.036379 |      0.0 | 0.0 | 0.0 |  74.484461 |      0.0 |  9.183165 | 0.010105 |
    | 01.01. 17:00 |  0.0 | 23.7 | 22.7 |  1.136569 |  24.3 | 24.3 |      1.0 | 1.1 | 0.0 |     0.0 |   1.31842 | 0.949262 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.441908 |   nan |      0.0 |      0.0 |   0.137057 |       0.0 |       0.0 | 0.0 | 0.045916 |  0.045916 |  0.046147 |  0.036147 |      0.0 | 0.0 | 0.0 |  74.042552 |      0.0 |  9.137249 | 0.010041 |
    | 01.01. 18:00 |  1.3 | 21.6 | 20.6 |  0.750986 |  22.2 | 22.2 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.871144 | 0.537465 | 0.537465 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  0.12436 |   nan |      0.0 |      0.0 |   0.136597 |       0.0 |       0.0 | 0.0 | 0.045686 |  0.045686 |  0.045916 |  0.035916 | 1.006935 | 0.0 | 0.0 |  73.918192 |      0.0 |  9.091563 | 0.009977 |
    | 01.01. 19:00 |  5.6 | 21.2 | 20.2 |  0.223895 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |  6.6528 |  0.259718 | 0.096141 | 0.096141 |  5.659735 |    0.0 |  0.0 |  0.0 |  5.659735 |  0.773106 | 0.023694 |   nan | 0.060598 |   0.0777 |     0.1554 |  0.712508 |  0.068166 | 0.0 | 0.045846 |  0.114013 |  0.060921 |  0.050921 | 1.903859 | 0.0 | 0.0 |  78.841725 | 0.566641 |  9.123417 | 0.014145 |
    | 01.01. 20:00 |  2.9 | 20.4 | 19.4 |  0.099425 |  21.0 | 21.0 |      1.0 | 1.1 | 0.0 |  3.4452 |  0.115333 | 0.058839 | 0.058839 |  3.349059 |    0.0 |  0.0 |  0.0 |  3.349059 |  0.520445 | 0.015028 |   nan | 0.059165 | 0.083466 |   0.166931 |   0.46128 |  0.181105 | 0.0 | 0.046034 |   0.22714 |  0.123968 |  0.113968 | 1.941161 | 0.0 | 0.0 |  81.714476 | 0.763351 |  9.160848 | 0.031658 |
    | 01.01. 21:00 |  4.9 | 19.8 | 18.8 |  0.098454 |  20.4 | 20.4 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.114207 | 0.045942 | 0.045942 |  5.762361 |    0.0 |  0.0 |  0.0 |  5.762361 |  0.961919 | 0.012429 |   nan | 0.056743 | 0.093656 |   0.187313 |  0.905176 |  0.594339 | 0.0 | 0.046273 |  0.640612 |  0.293883 |  0.283883 | 1.954058 | 0.0 | 0.0 |  86.559232 | 0.980532 |  9.208232 | 0.078856 |
    | 01.01. 22:00 | 10.6 | 19.6 | 18.6 |  0.098128 |  20.2 | 20.2 |      1.0 | 1.1 | 0.0 | 12.5928 |  0.113828 | 0.023264 | 0.023264 | 12.546858 |    0.0 |  0.0 |  0.0 | 12.546858 |  2.350184 | 0.007038 |   nan | 0.051622 | 0.117129 |   0.234258 |  2.298561 |  2.459152 | 0.0 | 0.046627 |  2.505778 |  0.963211 |  0.953211 | 1.976736 | 0.0 | 0.0 |  96.800491 | 0.702812 |  9.278734 | 0.264781 |
    | 01.01. 23:00 |  0.1 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.1188 |   0.11307 | 0.080449 | 0.080449 |  0.095536 |    0.0 |  0.0 |  0.0 |  0.095536 |   0.02238 | 0.024367 |   nan | 0.051563 | 0.117372 |   0.234744 | -0.029183 |  0.013306 | 0.0 | 0.046981 |  0.060286 |  1.547854 |  1.537854 | 1.919551 | 0.0 | 0.0 |  96.900842 | 0.542951 |  9.349126 | 0.427182 |
    | 02.01. 00:00 |  0.7 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.8316 |   0.11307 | 0.074914 | 0.074914 |  0.751151 |    0.0 |  0.0 |  0.0 |  0.751151 |  0.176328 | 0.022832 |   nan | 0.051262 | 0.118838 |   0.237676 |  0.125066 |  0.012336 | 0.0 |  0.04734 |  0.059676 |  0.603593 |  0.593593 | 1.925086 | 0.0 | 0.0 |  97.504096 | 0.536843 |  9.420624 | 0.164887 |
    | 02.01. 01:00 |  3.0 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |   3.564 |   0.11307 | 0.057003 | 0.057003 |  3.489086 |    0.0 |  0.0 |  0.0 |  3.489086 |  0.829273 | 0.017851 |   nan | 0.049918 |  0.12549 |   0.250981 |  0.779355 |  0.106781 | 0.0 | 0.047731 |  0.154511 |  0.080886 |  0.070886 | 1.942997 | 0.0 | 0.0 | 100.195975 | 1.083926 |  9.498384 | 0.019691 |
    | 02.01. 02:00 |  2.1 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |  2.4948 |  0.112498 | 0.063115 | 0.063115 |  2.437797 |    0.0 |  0.0 |  0.0 |  2.437797 |   0.61184 | 0.020132 |   nan | 0.048989 |  0.13018 |   0.260359 |  0.562851 |  0.197648 | 0.0 | 0.048143 |  0.245791 |  0.153721 |  0.143721 | 1.936885 | 0.0 | 0.0 | 102.050789 |  1.31895 |   9.58042 | 0.039923 |
    | 02.01. 03:00 | 10.4 | 18.7 | 17.7 |  0.096652 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 | 12.3552 |  0.112116 | 0.023465 | 0.023465 | 12.292085 |    0.0 |  0.0 |  0.0 | 12.292085 |  3.200356 | 0.008153 |   nan | 0.044429 | 0.154509 |   0.309018 |  3.155927 |  2.732817 | 0.0 | 0.048675 |  2.781491 |  0.788996 |  0.778996 | 1.976535 | 0.0 | 0.0 | 111.178794 | 1.587552 |  9.686255 | 0.216388 |
    | 02.01. 04:00 |  3.5 | 18.5 | 17.5 |  0.096321 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |   4.158 |  0.111732 |  0.05308 |  0.05308 |  4.134535 |    0.0 |  0.0 |  0.0 |  4.134535 |  1.277646 | 0.018923 |   nan | 0.042982 |  0.16262 |   0.325241 |  1.234664 |  0.546805 | 0.0 | 0.049244 |  0.596049 |  1.732349 |  1.722349 |  1.94692 | 0.0 | 0.0 | 114.059742 |  2.11279 |  9.799631 |  0.47843 |
    | 02.01. 05:00 |  3.4 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |  4.0392 |  0.111348 |  0.05353 |  0.05353 |   3.98612 |    0.0 |  0.0 |  0.0 |   3.98612 |  1.296448 | 0.019537 |   nan | 0.041625 | 0.170445 |    0.34089 |  1.254823 |  0.825003 | 0.0 |  0.04985 |  0.874853 |  1.143659 |  1.133659 |  1.94647 | 0.0 | 0.0 | 116.771503 | 2.372166 |  9.920225 | 0.314905 |
    | 02.01. 06:00 |  1.2 | 18.5 | 17.5 |  0.187298 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |  1.4256 |  0.217266 | 0.135647 | 0.135647 |   1.37207 |    0.0 |  0.0 |  0.0 |   1.37207 |  0.467724 |   0.0499 |   nan | 0.041162 | 0.173069 |   0.346139 |  0.426562 |   0.43648 | 0.0 | 0.050466 |  0.486946 |  0.726695 |  0.716695 | 1.864353 | 0.0 | 0.0 |  117.66711 | 2.189179 | 10.042828 | 0.199082 |
    | 02.01. 07:00 |  0.1 | 18.8 | 17.8 |  1.264612 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  0.1188 |   1.46695 |  1.04373 |  1.04373 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.383924 |   nan | 0.041166 | 0.172063 |   0.344125 | -0.041166 |  0.189312 | 0.0 | 0.051074 |  0.240387 |  0.518357 |  0.508357 | 0.939422 | 0.0 | 0.0 | 117.324353 | 1.786638 | 10.163816 |  0.14121 |
    | 02.01. 08:00 |  0.0 | 18.8 | 17.8 |  3.045538 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |     0.0 |  3.532824 | 2.543633 | 0.939422 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.735028 |   nan | 0.041338 | 0.167131 |   0.334261 | -0.041338 |  0.105245 | 0.0 | 0.051655 |    0.1569 |  0.276625 |  0.266625 |      0.0 | 0.0 | 0.0 | 115.630662 | 1.472924 | 10.279292 | 0.074063 |
    | 02.01. 09:00 |  0.0 | 19.0 | 18.0 |  1.930758 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |     0.0 |  2.239679 | 1.612569 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.165815 |   nan | 0.042185 | 0.163898 |   0.327797 | -0.042185 |  0.057724 | 0.0 | 0.052216 |   0.10994 |  0.165017 |  0.155017 |      0.0 | 0.0 | 0.0 | 114.507032 | 1.209117 | 10.390974 |  0.04306 |
    | 02.01. 10:00 |  0.4 | 19.2 | 18.2 |  2.461001 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.4752 |  2.854761 | 1.960038 |   0.4752 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.403262 |   nan | 0.042746 | 0.160027 |   0.320053 | -0.042746 |  0.031087 | 0.0 | 0.052755 |  0.083842 |  0.114576 |  0.104576 |      0.0 | 0.0 | 0.0 | 113.146516 | 0.975258 | 10.498246 | 0.029049 |
    | 02.01. 11:00 |  0.1 | 19.3 | 18.3 |  6.215945 |  19.9 | 19.9 |      1.0 | 1.1 | 0.0 |  0.1188 |  7.210496 | 5.130246 |   0.1188 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.629327 |   nan | 0.043427 | 0.150044 |   0.300088 | -0.043427 |  0.017681 | 0.0 | 0.053241 |  0.070923 |   0.08677 |   0.07677 |      0.0 | 0.0 | 0.0 | 109.560616 | 0.764105 | 10.595049 | 0.021325 |
    | 02.01. 12:00 |  3.6 | 19.0 | 18.0 |  3.374783 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |  4.2768 |  3.914748 | 1.837796 | 1.837796 |    2.2768 |    0.0 |  0.0 |  0.0 |    2.2768 |  0.683241 | 0.638626 |   nan | 0.044423 | 0.152794 |   0.305588 |  0.638818 |  0.068463 | 0.0 | 0.053739 |  0.122202 |  0.085189 |  0.075189 | 0.162204 | 0.0 | 0.0 | 110.559972 | 1.181666 | 10.694103 | 0.020886 |
    | 02.01. 13:00 |  5.9 | 18.8 | 17.8 |  8.821555 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  7.0092 | 10.233004 | 3.655358 |      2.0 |  5.171404 |    0.0 |  0.0 |  0.0 |  5.171404 |  1.580317 | 2.132116 |   nan | 0.042924 | 0.156973 |   0.313947 |  1.537393 |  0.543518 | 0.0 | 0.054255 |  0.597773 |  0.216489 |  0.206489 |      0.0 | 0.0 | 0.0 | 112.061866 | 2.018568 | 10.796821 | 0.057358 |
    | 02.01. 14:00 |  1.1 | 18.7 | 17.7 |  4.046025 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 |  1.3068 |  4.693389 | 2.965278 |   1.3068 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.868067 |   nan | 0.043969 | 0.151905 |   0.303809 | -0.043969 |  0.215943 | 0.0 | 0.054744 |  0.270687 |  0.419405 |  0.409405 |      0.0 | 0.0 | 0.0 | 110.237768 | 1.606751 | 10.893982 | 0.113724 |
    | 02.01. 15:00 | 20.7 | 17.8 | 16.8 |  2.110757 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 | 24.5916 |  2.448478 |  0.15074 |  0.15074 |   22.5916 |    0.0 |  0.0 |  0.0 |   22.5916 |  6.863535 | 0.059355 |   nan | 0.037017 | 0.198272 |   0.396544 |  6.826517 |  8.234997 | 0.0 | 0.055461 |  8.290458 |  2.125544 |  2.115544 |  1.84926 | 0.0 | 0.0 | 125.943496 |      0.0 | 11.036793 | 0.587651 |
    | 02.01. 16:00 | 37.9 | 17.4 | 16.4 |  2.239257 |  18.0 | 18.0 |      1.0 | 1.1 | 0.0 | 45.0252 |  2.597538 | 0.020724 | 0.020724 |  44.87446 |    0.0 |  0.0 |  0.0 |  44.87446 | 17.794702 | 0.009912 |   nan | 0.023488 | 0.292753 |   0.585507 | 17.771214 | 17.478461 | 0.0 | 0.056648 | 17.535108 |  8.562653 |  8.552653 | 1.979276 | 0.0 | 0.0 |  153.03683 |      0.0 | 11.272899 | 2.375737 |
    | 02.01. 17:00 |  8.2 | 17.3 | 16.3 |  2.877848 |  17.9 | 17.9 |      1.0 | 1.1 | 0.0 |  9.7416 |  3.338304 | 0.907373 | 0.907373 |  9.720876 |    0.0 |  0.0 |  0.0 |  9.720876 |  5.691639 | 0.445428 |   nan | 0.021467 | 0.306709 |   0.613419 |  5.670172 |  0.668443 | 0.0 | 0.057898 |  0.726341 |  11.74546 |  11.73546 | 1.092627 | 0.0 | 0.0 | 156.642106 | 4.695019 |  11.52171 |  3.25985 |
    | 02.01. 18:00 |  3.6 | 16.8 | 15.8 |  1.591452 |  17.4 | 17.4 |      1.0 | 1.1 | 0.0 |  4.2768 |  1.846084 | 0.866652 | 0.866652 |  3.369427 |    0.0 |  0.0 |  0.0 |  3.369427 |  2.066869 | 0.427817 |   nan | 0.021028 | 0.310227 |   0.620455 |  2.045842 |  1.113349 | 0.0 |  0.05916 |  1.172509 |  4.560771 |  4.550771 | 1.133348 | 0.0 | 0.0 | 157.537874 | 5.317284 | 11.772778 | 1.264103 |
    | 02.01. 19:00 |  7.5 | 16.5 | 15.5 |  0.291604 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |    8.91 |  0.338261 | 0.099914 | 0.099914 |  8.043348 |    0.0 |  0.0 |  0.0 |  8.043348 |  4.990532 | 0.049957 |   nan | 0.019705 | 0.322246 |   0.644491 |  4.970827 |  3.697378 | 0.0 | 0.060475 |  3.757853 |  1.647881 |  1.637881 | 1.900086 | 0.0 | 0.0 | 160.560437 | 6.268488 | 12.034548 | 0.454967 |
    | 02.01. 20:00 | 18.5 | 16.3 | 15.3 |  0.092622 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  21.978 |  0.107442 |  0.00859 |  0.00859 | 21.878086 |    0.0 |  0.0 |  0.0 | 21.878086 | 14.100237 | 0.004295 |   nan | 0.015831 | 0.354271 |   0.708542 | 14.084406 | 19.998623 | 0.0 | 0.061944 | 20.060568 |  6.806157 |  6.796157 |  1.99141 | 0.0 | 0.0 | 168.349822 |      0.0 | 12.326875 | 1.887821 |
    | 02.01. 21:00 | 15.4 | 16.2 | 15.2 |  0.092451 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 | 18.2952 |  0.107243 | 0.012392 | 0.012392 |  18.28661 |    0.0 |  0.0 |  0.0 |  18.28661 | 12.956823 | 0.006196 |   nan |  0.01316 | 0.377088 |   0.754176 | 12.943663 |  4.626295 | 0.0 |  0.06352 |  4.689814 | 13.022019 | 13.012019 | 1.987608 | 0.0 | 0.0 | 173.686572 |  7.94028 | 12.640443 |  3.61445 |
    | 02.01. 22:00 |  6.3 | 15.5 | 14.5 |  0.091248 |  16.1 | 16.1 |      1.0 | 1.1 | 0.0 |  7.4844 |  0.105848 | 0.036055 | 0.036055 |  7.472008 |    0.0 |  0.0 |  0.0 |  7.472008 |  5.635206 | 0.018028 |   nan | 0.012238 |  0.38508 |   0.770161 |  5.622968 |   5.00981 | 0.0 | 0.065128 |  5.074938 |   8.19112 |   8.18112 | 1.963945 | 0.0 | 0.0 | 175.517585 | 8.168358 | 12.960395 | 2.272533 |
    | 02.01. 23:00 |  1.9 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  2.2572 |  0.104032 | 0.059768 | 0.059768 |  2.221145 |    0.0 |  0.0 |  0.0 |  2.221145 |  1.710638 | 0.029884 |   nan | 0.011986 | 0.387245 |    0.77449 |  1.698652 |  1.833774 | 0.0 | 0.066738 |  1.900512 |  4.283927 |  4.273927 | 1.940232 | 0.0 | 0.0 | 176.010193 | 7.645991 | 13.280902 | 1.187202 |
    | 03.01. 00:00 |  4.9 | 14.7 | 13.7 |  0.089858 |  15.3 | 15.3 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.104235 | 0.041931 | 0.041931 |  5.761432 |    0.0 |  0.0 |  0.0 |  5.761432 |  4.462169 | 0.020966 |   nan | 0.011345 |  0.39294 |   0.785881 |  4.450824 |  3.303079 | 0.0 | 0.068369 |  3.371448 |  2.932815 |  2.922815 | 1.958069 | 0.0 | 0.0 | 177.299835 | 8.400796 | 13.605473 | 0.811893 |
    | 03.01. 01:00 |  2.7 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  3.2076 |  0.104032 |  0.05435 |  0.05435 |  3.165669 |    0.0 |  0.0 |  0.0 |  3.165669 |  2.487838 | 0.027175 |   nan | 0.011011 | 0.395879 |   0.791757 |  2.476827 |  2.320194 | 0.0 | 0.070007 |  2.390201 |  2.826519 |  2.816519 |  1.94565 | 0.0 | 0.0 | 177.961502 |  8.16155 | 13.931345 | 0.782366 |
    | 03.01. 02:00 |  0.5 | 14.1 | 13.1 |  0.088805 |  14.7 | 14.7 |      1.0 | 1.1 | 0.0 |   0.594 |  0.103014 | 0.069893 | 0.069893 |   0.53965 |    0.0 |  0.0 |  0.0 |   0.53965 |  0.427272 | 0.034946 |   nan | 0.010963 | 0.396272 |   0.792544 |  0.416309 |  1.100126 | 0.0 | 0.071638 |  1.171764 |  2.337492 |  2.327492 | 1.930107 | 0.0 | 0.0 | 178.049897 | 7.081462 | 14.255979 | 0.646526 |
    | 03.01. 03:00 |  0.2 | 14.3 | 13.3 |  0.089157 |  14.9 | 14.9 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.103422 | 0.072716 | 0.072716 |  0.167707 |    0.0 |  0.0 |  0.0 |  0.167707 |  0.132916 | 0.036358 |   nan | 0.010958 | 0.396314 |   0.792628 |  0.121958 |  0.633402 | 0.0 | 0.073261 |  0.706664 |  1.339172 |  1.329172 | 1.927284 | 0.0 | 0.0 | 178.059289 | 6.173703 | 14.579032 | 0.369214 |
    | 03.01. 04:00 |  0.5 | 14.9 | 13.9 |  0.090207 |  15.5 | 15.5 |      1.0 | 1.1 | 0.0 |   0.594 |   0.10464 | 0.070996 | 0.070996 |  0.521284 |    0.0 |  0.0 |  0.0 |  0.521284 |  0.413185 | 0.035498 |   nan | 0.010916 | 0.396686 |   0.793371 |  0.402268 |  0.472482 | 0.0 | 0.074879 |   0.54736 |  0.774619 |  0.764619 | 1.929004 | 0.0 | 0.0 | 178.142807 | 5.706804 | 14.900839 | 0.212394 |
    | 03.01. 05:00 |  2.4 | 15.7 | 14.7 |  0.091593 |  16.3 | 16.3 |      1.0 | 1.1 | 0.0 |  2.8512 |  0.106248 | 0.057521 | 0.057521 |  2.780204 |    0.0 |  0.0 |  0.0 |  2.780204 |  2.205735 | 0.028761 |   nan | 0.010641 | 0.399167 |   0.798335 |  2.195093 |  0.830047 | 0.0 |   0.0765 |  0.906547 |   0.66258 |   0.65258 | 1.942479 | 0.0 | 0.0 | 178.699157 | 6.672683 | 15.223506 | 0.181272 |
    | 03.01. 06:00 |  0.4 | 16.0 | 15.0 |  0.154861 |  16.6 | 16.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  0.179639 | 0.123337 | 0.123337 |  0.417679 |    0.0 |  0.0 |  0.0 |  0.417679 |  0.333448 | 0.061669 |   nan | 0.010608 | 0.399316 |   0.798631 |  0.322839 |  0.563435 | 0.0 | 0.078114 |  0.641549 |   0.76784 |   0.75784 | 1.876663 | 0.0 | 0.0 | 178.732328 | 6.032771 | 15.544708 | 0.210511 |
    | 03.01. 07:00 |  0.2 | 16.7 | 15.7 |  0.470369 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.545628 | 0.383628 | 0.383628 |  0.114263 |    0.0 |  0.0 |  0.0 |  0.114263 |  0.091254 | 0.191814 |   nan | 0.010622 | 0.398609 |   0.797218 |  0.080631 |  0.368358 | 0.0 | 0.079717 |  0.448075 |  0.657443 |  0.647443 | 1.616372 | 0.0 | 0.0 | 178.574145 | 5.346435 |   15.8636 | 0.179845 |
    | 03.01. 08:00 |  0.0 | 17.1 | 16.1 |  1.173726 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  1.361522 | 0.980296 | 0.980296 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.490148 |   nan | 0.010713 | 0.396472 |   0.792943 | -0.010713 |  0.241689 | 0.0 |   0.0813 |  0.322989 |  0.463272 |  0.453272 | 0.636076 | 0.0 | 0.0 |  178.09471 | 4.697562 | 16.178771 | 0.125909 |
    | 03.01. 09:00 |  0.0 | 16.2 | 15.2 |  4.202296 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 |     0.0 |  4.874663 | 3.509758 | 0.636076 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  3.19172 |   nan | 0.010953 | 0.382436 |   0.764872 | -0.010953 |  0.178198 | 0.0 | 0.082806 |  0.261004 |  0.337012 |  0.327012 |      0.0 | 0.0 | 0.0 | 174.913943 | 4.125975 | 16.478401 | 0.090837 |
    | 03.01. 10:00 |  0.3 | 15.9 | 14.9 |  4.359715 |  16.5 | 16.5 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.057269 | 3.513746 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.335546 |   nan | 0.012543 | 0.368043 |   0.736086 | -0.012543 |  0.131736 | 0.0 | 0.084232 |  0.215968 |  0.264771 |  0.254771 |      0.0 | 0.0 | 0.0 | 171.590941 | 3.613653 | 16.762212 |  0.07077 |
    | 03.01. 11:00 |  2.6 | 16.3 | 15.3 |  5.305753 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  3.0888 |  6.154673 | 3.253813 |      2.0 |    1.0888 |    0.0 |  0.0 |  0.0 |    1.0888 |  0.801451 | 2.253813 |   nan | 0.014061 | 0.359715 |   0.719431 |   0.78739 |  0.177258 | 0.0 |  0.08561 |  0.262867 |  0.236398 |  0.226398 |      0.0 | 0.0 | 0.0 | 169.638537 |  3.86407 | 17.036318 | 0.062888 |
    | 03.01. 12:00 |  0.7 | 16.3 | 15.3 |  5.376027 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  0.8316 |  6.236191 | 4.131769 |   0.8316 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.715969 |   nan | 0.015181 | 0.344192 |   0.688383 | -0.015181 |  0.131965 | 0.0 | 0.086903 |  0.218868 |  0.242668 |  0.232668 |      0.0 | 0.0 | 0.0 | 165.937749 | 3.372732 | 17.293607 |  0.06463 |
    | 03.01. 13:00 |  0.3 | 16.4 | 15.4 |  4.658915 |  17.0 | 17.0 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.404341 | 3.754888 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.576688 |   nan | 0.017031 | 0.329583 |   0.659166 | -0.017031 |  0.096755 | 0.0 | 0.088116 |  0.184871 |  0.221091 |  0.211091 |      0.0 | 0.0 | 0.0 | 162.378092 | 2.929363 | 17.535074 | 0.058636 |
    | 03.01. 14:00 |  0.3 | 16.5 | 15.5 |  7.789594 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |  0.3564 |  9.035929 | 6.278083 |   0.3564 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 6.099883 |   nan | 0.018811 | 0.305359 |   0.610719 | -0.018811 |  0.077624 | 0.0 | 0.089202 |  0.166826 |  0.188416 |  0.178416 |      0.0 | 0.0 | 0.0 |  156.29702 | 2.527568 | 17.751232 |  0.04956 |
    | 03.01. 15:00 |  0.0 | 18.4 | 17.4 |  4.851567 |  19.0 | 19.0 |      1.0 | 1.1 | 0.0 |     0.0 |  5.627818 | 4.052029 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.958804 |   nan | 0.021851 |  0.29017 |    0.58034 | -0.021851 |  0.055641 | 0.0 | 0.090207 |  0.145848 |  0.166174 |  0.156174 |      0.0 | 0.0 | 0.0 | 152.360068 | 2.159906 | 17.951194 | 0.043382 |
    | 03.01. 16:00 |  0.0 | 18.3 | 17.3 |   5.30692 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  6.156027 |  4.43234 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.221357 |   nan |  0.02382 | 0.274402 |   0.548803 |  -0.02382 |  0.039036 | 0.0 | 0.091128 |  0.130164 |  0.147025 |  0.137025 |      0.0 | 0.0 | 0.0 | 148.162531 | 1.822648 | 18.134468 | 0.038062 |
    | 03.01. 17:00 |  0.0 | 18.1 | 17.1 |  3.286036 |  18.7 | 18.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.811802 | 2.744497 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 2.541892 |   nan | 0.025919 | 0.265161 |   0.530323 | -0.025919 |  0.024087 | 0.0 | 0.091998 |  0.116085 |  0.130521 |  0.120521 |      0.0 | 0.0 | 0.0 | 145.646557 | 1.507481 | 18.307631 | 0.033478 |
    | 03.01. 18:00 |  0.0 | 16.7 | 15.7 |  1.506216 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |     0.0 |  1.747211 | 1.257992 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.145352 |   nan | 0.027177 | 0.261106 |   0.522211 | -0.027177 |  0.012726 | 0.0 | 0.092844 |  0.105569 |  0.116877 |  0.106877 |      0.0 | 0.0 | 0.0 | 144.528382 | 1.206472 | 18.475893 | 0.029688 |
    | 03.01. 19:00 |  0.0 | 15.2 | 14.2 |  0.274762 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.318724 | 0.229481 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.207331 |   nan | 0.027736 | 0.260457 |   0.520914 | -0.027736 |  0.005478 | 0.0 | 0.093682 |   0.09916 |  0.106482 |  0.096482 |      0.0 | 0.0 | 0.0 | 144.348787 | 0.912801 | 18.642669 | 0.026801 |
    | 03.01. 20:00 |  0.0 | 13.4 | 12.4 |  0.087565 |  14.0 | 14.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.101575 | 0.073134 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.065993 |   nan | 0.027826 | 0.260319 |   0.520639 | -0.027826 |  0.001727 | 0.0 | 0.094515 |  0.096242 |  0.099936 |  0.089936 |      0.0 | 0.0 | 0.0 |  144.31062 | 0.622929 | 18.808473 | 0.024982 |
    | 03.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.064624 |   nan | 0.027845 | 0.260187 |   0.520374 | -0.027845 |  0.000267 | 0.0 | 0.095343 |   0.09561 |   0.09675 |   0.08675 |      0.0 | 0.0 | 0.0 |  144.27384 | 0.334631 | 18.973317 | 0.024097 |
    | 03.01. 22:00 |  0.0 | 11.6 | 10.6 |  0.084317 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |     0.0 |  0.097808 | 0.070422 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063512 |   nan | 0.027863 | 0.260058 |   0.520116 | -0.027863 |  0.000001 | 0.0 | 0.096167 |  0.096168 |  0.095874 |  0.085874 |      0.0 | 0.0 | 0.0 | 144.238191 | 0.046709 | 19.137208 | 0.023854 |
    | 03.01. 23:00 |  0.0 | 11.0 | 10.0 |  0.083215 |  11.6 | 11.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096529 | 0.069501 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.062667 |   nan | 0.027881 | 0.018828 |   0.519866 | -0.027881 |       0.0 | 0.0 |  0.09578 |   0.09578 |  0.095958 |  0.085958 |      0.0 | 0.0 | 0.0 | 144.203406 |      0.0 | 19.060256 | 0.023877 |
    | 04.01. 00:00 |  0.0 | 10.5 |  9.5 |  0.082289 |  11.1 | 11.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.095455 | 0.068728 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.061942 |   nan |      0.0 |      0.0 |   0.519419 |       0.0 |       0.0 | 0.0 | 0.095301 |  0.095301 |   0.09576 |   0.08576 |      0.0 | 0.0 | 0.0 | 144.141463 |      0.0 | 18.964955 | 0.023822 |
    | 04.01. 01:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063579 |   nan |      0.0 |      0.0 |   0.518961 |       0.0 |       0.0 | 0.0 | 0.094825 |  0.094825 |  0.095302 |  0.085302 |      0.0 | 0.0 | 0.0 | 144.077884 |      0.0 |  18.87013 | 0.023695 |
    | 04.01. 02:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.063825 |   nan |      0.0 |      0.0 |   0.518501 |       0.0 |       0.0 | 0.0 | 0.094351 |  0.094351 |  0.094825 |  0.084825 |      0.0 | 0.0 | 0.0 | 144.014059 |      0.0 |  18.77578 | 0.023563 |
    | 04.01. 03:00 |  1.3 | 11.2 | 10.2 |  0.083584 |  11.8 | 11.8 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.096957 | 0.059819 | 0.059819 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.026921 |   nan |      0.0 |      0.0 |   0.518307 |       0.0 |       0.0 | 0.0 | 0.093879 |  0.093879 |  0.094351 |  0.084351 | 1.484581 | 0.0 | 0.0 | 143.987137 |      0.0 | 18.681901 | 0.023431 |
    | 04.01. 04:00 |  0.0 | 11.1 | 10.1 |    0.0834 |  11.7 | 11.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096744 | 0.069656 | 0.069656 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.031342 |   nan |      0.0 |      0.0 |   0.518082 |       0.0 |       0.0 | 0.0 |  0.09341 |   0.09341 |  0.093879 |  0.083879 | 1.414925 | 0.0 | 0.0 | 143.955795 |      0.0 | 18.588491 |   0.0233 |
    | 04.01. 05:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 | 0.070878 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.031885 |   nan |      0.0 |      0.0 |   0.517852 |       0.0 |       0.0 | 0.0 | 0.092942 |  0.092942 |   0.09341 |   0.08341 | 1.344047 | 0.0 | 0.0 |  143.92391 |      0.0 | 18.495549 | 0.023169 |
    | 04.01. 06:00 |  0.0 | 12.2 | 11.2 |  0.310229 |  12.8 | 12.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.359866 | 0.259103 | 0.259103 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.116535 |   nan |      0.0 |      0.0 |   0.517014 |       0.0 |       0.0 | 0.0 | 0.092478 |  0.092478 |  0.092943 |  0.082943 | 1.084943 | 0.0 | 0.0 | 143.807375 |      0.0 | 18.403071 |  0.02304 |
    | 04.01. 07:00 |  0.7 | 11.8 | 10.8 |  1.391958 |  12.4 | 12.4 |      1.0 | 1.1 | 0.0 |  0.8316 |  1.614671 | 1.069795 | 1.069795 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.480764 |   nan |      0.0 |      0.0 |   0.513563 |       0.0 |       0.0 | 0.0 | 0.092015 |  0.092015 |  0.092478 |  0.082478 | 0.846748 | 0.0 | 0.0 | 143.326611 |      0.0 | 18.311056 | 0.022911 |
    | 04.01. 08:00 |  0.4 | 11.4 | 10.4 |  3.195876 |  12.0 | 12.0 |      1.0 | 1.1 | 0.0 |  0.4752 |  3.707216 | 2.545322 | 1.321948 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.751726 |   nan |      0.0 |      0.0 |   0.501086 |       0.0 |       0.0 | 0.0 | 0.091555 |  0.091555 |  0.092016 |  0.082016 |      0.0 | 0.0 | 0.0 | 141.574885 |      0.0 |   18.2195 | 0.022782 |
    | 04.01. 09:00 |  0.1 | 11.6 | 10.6 |  5.191651 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |  0.1188 |  6.022315 | 4.284859 |   0.1188 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.791428 |   nan |      0.0 |      0.0 |   0.474607 |       0.0 |       0.0 | 0.0 | 0.091098 |  0.091098 |  0.091556 |  0.081556 |      0.0 | 0.0 | 0.0 | 137.783457 |      0.0 | 18.128403 | 0.022654 |
    | 04.01. 10:00 |  0.4 | 13.0 | 12.0 |  7.155036 |  13.6 | 13.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  8.299842 | 5.698554 |   0.4752 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 |  4.90729 |   nan |      0.0 |      0.0 |   0.441402 |       0.0 |       0.0 | 0.0 | 0.090642 |  0.090642 |  0.091098 |  0.081098 |      0.0 | 0.0 | 0.0 | 132.876167 |      0.0 | 18.037761 | 0.022527 |
    | 04.01. 11:00 |  0.0 | 17.1 | 16.1 |  8.391432 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  9.734061 | 7.008524 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.820411 |   nan |      0.0 |      0.0 |   0.403579 |       0.0 |       0.0 | 0.0 | 0.090189 |  0.090189 |  0.090643 |  0.080643 |      0.0 | 0.0 | 0.0 | 127.055756 |      0.0 | 17.947572 | 0.022401 |
    | 04.01. 12:00 |  0.0 | 18.2 | 17.2 |  8.391286 |  18.8 | 18.8 |      1.0 | 1.1 | 0.0 |     0.0 |  9.733892 | 7.008402 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.565361 |   nan |      0.0 |      0.0 |   0.368998 |       0.0 |       0.0 | 0.0 | 0.089738 |  0.089738 |  0.090189 |  0.080189 |      0.0 | 0.0 | 0.0 | 121.490395 |      0.0 | 17.857834 | 0.022275 |
    | 04.01. 13:00 |  0.0 | 22.4 | 21.4 | 10.715238 |  23.0 | 23.0 |      1.0 | 1.1 | 0.0 |     0.0 | 12.429676 | 8.949367 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 6.795388 |   nan |      0.0 |      0.0 |   0.328874 |       0.0 |       0.0 | 0.0 | 0.089289 |  0.089289 |  0.089738 |  0.079738 |      0.0 | 0.0 | 0.0 | 114.695007 |      0.0 | 17.768545 |  0.02215 |
    | 04.01. 14:00 |  0.0 | 21.4 | 20.4 |  9.383394 |  22.0 | 22.0 |      1.0 | 1.1 | 0.0 |     0.0 | 10.884737 | 7.837011 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 5.617912 |   nan |      0.0 |      0.0 |   0.297445 |       0.0 |       0.0 | 0.0 | 0.088843 |  0.088843 |   0.08929 |   0.07929 |      0.0 | 0.0 | 0.0 | 109.077094 |      0.0 | 17.679702 | 0.022025 |
    | 04.01. 15:00 |  0.0 | 21.8 | 20.8 |  7.861915 |  22.4 | 22.4 |      1.0 | 1.1 | 0.0 |     0.0 |  9.119821 | 6.566271 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 4.476436 |   nan |      0.0 |      0.0 |   0.273532 |       0.0 |       0.0 | 0.0 | 0.088399 |  0.088399 |  0.088843 |  0.078843 |      0.0 | 0.0 | 0.0 | 104.600658 |      0.0 | 17.591304 | 0.021901 |
    | 04.01. 16:00 |  0.0 | 22.2 | 21.2 |  6.298329 |  22.8 | 22.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.306062 | 5.260364 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 3.438985 |   nan |      0.0 |      0.0 |   0.255842 |       0.0 |       0.0 | 0.0 | 0.087957 |  0.087957 |  0.088399 |  0.078399 |      0.0 | 0.0 | 0.0 | 101.161673 |      0.0 | 17.503347 | 0.021778 |
    | 04.01. 17:00 |  0.0 | 20.1 | 19.1 |  2.948416 |  20.7 | 20.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.420163 | 2.462517 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 1.556952 |   nan |      0.0 |      0.0 |   0.248028 |       0.0 |       0.0 | 0.0 | 0.087517 |  0.087517 |  0.087957 |  0.077957 |      0.0 | 0.0 | 0.0 |  99.604721 |      0.0 | 17.415831 | 0.021655 |
    | 04.01. 18:00 |  0.0 | 17.8 | 16.8 |  1.309232 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 |     0.0 |  1.518709 | 1.093471 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.680718 |   nan |      0.0 |      0.0 |   0.244649 |       0.0 |       0.0 | 0.0 | 0.087079 |  0.087079 |  0.087517 |  0.077517 |      0.0 | 0.0 | 0.0 |  98.924003 |      0.0 | 17.328751 | 0.021533 |
    | 04.01. 19:00 |  0.0 | 15.2 | 14.2 |   0.32955 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.382278 |  0.27524 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.170174 |   nan |      0.0 |      0.0 |   0.243808 |       0.0 |       0.0 | 0.0 | 0.086644 |  0.086644 |   0.08708 |   0.07708 |      0.0 | 0.0 | 0.0 |  98.753829 |      0.0 | 17.242108 | 0.021411 |
    | 04.01. 20:00 |  0.0 | 14.5 | 13.5 |  0.089508 |  15.1 | 15.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.103829 | 0.074757 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.046141 |   nan |      0.0 |      0.0 |    0.24358 |       0.0 |       0.0 | 0.0 | 0.086211 |  0.086211 |  0.086644 |  0.076644 |      0.0 | 0.0 | 0.0 |  98.707688 |      0.0 | 17.155897 |  0.02129 |
    | 04.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.044194 |   nan |      0.0 |      0.0 |   0.243362 |       0.0 |       0.0 | 0.0 | 0.085779 |  0.085779 |  0.086211 |  0.076211 |      0.0 | 0.0 | 0.0 |  98.663494 |      0.0 | 17.070118 |  0.02117 |
    | 04.01. 22:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.043519 |   nan |      0.0 |      0.0 |   0.243147 |       0.0 |       0.0 | 0.0 | 0.085351 |  0.085351 |   0.08578 |   0.07578 |      0.0 | 0.0 | 0.0 |  98.619975 |      0.0 | 16.984767 |  0.02105 |
    | 04.01. 23:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 |      0.0 |       0.0 |    0.0 |  0.0 |  0.0 |       0.0 |       0.0 | 0.043688 |   nan |      0.0 |      0.0 |   0.242932 |       0.0 |       0.0 | 0.0 | 0.084924 |  0.084924 |  0.085351 |  0.075351 |      0.0 | 0.0 | 0.0 |  98.576287 |      0.0 | 16.899843 | 0.020931 |

    .. raw:: html

        <iframe
            src="hland_v1_ex3.html"
            width="100%"
            height="930px"
            frameborder=0
        ></iframe>

    .. _hland_v1_ex4:

    **Example 4**

    In the fourth example, the functionality of zones of type |ILAKE| is
    demonstrated.  For these "internal lakes" only the lower zone storage
    (|LZ|) is relevant (all other storage values are zero).  Precipitation
    (|PC|) is directly added to |LZ| and evaporation (|EPC|) is directly
    subtracted from |LZ|.  The latter occurs even when |LZ| is completely
    empty, possibly resulting in negative storage values in drought periods.
    The only case for which lake evaporation (|EL|) is prevented is when
    the actual temperature (|TC|) is below the threshold temperature
    for the occurrence of lake ice (|TTIce|).  In this example, the value
    of |TTIce| is set to the unrealistic value of 13°C, resulting in a
    deviation between the graphs of |EPC| and |EL| for the last day of
    the simulation period:

    >>> recstep(100)
    >>> zonetype(ILAKE)
    >>> ttice(13.0)
    >>> parameters.update()
    >>> test('hland_v1_ex4')
    |         date |    p |    t |   tn |       epn | tmean |   tc | fracrain | rfc | sfc |      pc |        ep |      epc |  ei |      tf | glmelt | melt | refr |     in_ |       r |  ea | cfpot |  cf | perc | contriarea | inuz |  q0 |       el |       q1 |     inuh |    outuh |       qt |  ic |  sp |  wc |  sm |  uz |         lz |   outlet |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. 00:00 |  0.0 | 21.2 | 20.2 |  0.100707 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |     0.0 |   0.11682 |  0.08411 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.08411 | 0.049579 | 0.049579 | 0.061018 | 0.051018 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |    9.86631 | 0.014172 |
    | 01.01. 01:00 |  0.0 | 19.4 | 18.4 |  0.097801 |  20.0 | 20.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.113449 | 0.081683 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.081683 | 0.048923 | 0.048923 | 0.088416 | 0.078416 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   9.735704 | 0.021782 |
    | 01.01. 02:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.080999 | 0.048274 | 0.048274 | 0.048925 | 0.038925 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   9.606431 | 0.010812 |
    | 01.01. 03:00 |  0.0 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  0.111348 | 0.080171 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.080171 | 0.047631 | 0.047631 | 0.048275 | 0.038275 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   9.478629 | 0.010632 |
    | 01.01. 04:00 |  0.0 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.112498 | 0.080999 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.080999 | 0.046988 | 0.046988 | 0.047631 | 0.037631 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   9.350643 | 0.010453 |
    | 01.01. 05:00 |  0.0 | 22.5 | 21.5 |  0.102761 |  23.1 | 23.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.119203 | 0.085826 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.085826 | 0.046324 | 0.046324 | 0.046984 | 0.036984 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   9.218493 | 0.010273 |
    | 01.01. 06:00 |  0.0 | 25.1 | 24.1 |  0.291908 |  25.7 | 25.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.338613 | 0.243802 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.243802 | 0.044873 | 0.044873 | 0.046149 | 0.036149 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   8.929818 | 0.010041 |
    | 01.01. 07:00 |  0.0 | 28.3 | 27.3 |  1.932875 |  28.9 | 28.9 |      1.0 | 1.1 | 0.0 |     0.0 |  2.242135 | 1.614337 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.614337 | 0.036577 | 0.036577 | 0.043352 | 0.033352 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   7.278903 | 0.009265 |
    | 01.01. 08:00 |  0.0 | 27.8 | 26.8 |  4.369536 |  28.4 | 28.4 |      1.0 | 1.1 | 0.0 |     0.0 |  5.068662 | 3.649436 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 3.649436 | 0.018147 | 0.018147 | 0.034325 | 0.024325 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   3.611319 | 0.006757 |
    | 01.01. 09:00 |  0.0 | 31.4 | 30.4 |  7.317556 |  32.0 | 32.0 |      1.0 | 1.1 | 0.0 |     0.0 |  8.488365 | 6.111623 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 6.111623 |      0.0 |      0.0 |  0.01821 |  0.00821 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -2.500304 | 0.002281 |
    | 01.01. 10:00 |  0.0 | 32.2 | 31.2 |  8.264362 |  32.8 | 32.8 |      1.0 | 1.1 | 0.0 |     0.0 |   9.58666 | 6.902395 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 6.902395 |      0.0 |      0.0 | 0.004033 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -9.402699 |      0.0 |
    | 01.01. 11:00 |  0.0 | 35.2 | 34.2 |  9.369867 |  35.8 | 35.8 |      1.0 | 1.1 | 0.0 |     0.0 | 10.869046 | 7.825713 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 7.825713 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -17.228412 |      0.0 |
    | 01.01. 12:00 |  0.0 | 37.1 | 36.1 |  5.126178 |  37.7 | 37.7 |      1.0 | 1.1 | 0.0 |     0.0 |  5.946366 | 4.281384 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 4.281384 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -21.509796 |      0.0 |
    | 01.01. 13:00 |  0.0 | 31.2 | 30.2 |   6.62503 |  31.8 | 31.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.685035 | 5.533225 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 5.533225 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -27.043021 |      0.0 |
    | 01.01. 14:00 |  0.0 | 24.3 | 23.3 |  7.397619 |  24.9 | 24.9 |      1.0 | 1.1 | 0.0 |     0.0 |  8.581238 | 6.178491 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 6.178491 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -33.221512 |      0.0 |
    | 01.01. 15:00 |  0.2 | 25.4 | 24.4 |   2.39151 |  26.0 | 26.0 |      1.0 | 1.1 | 0.0 |  0.2376 |  2.774152 | 1.950491 | 0.0 |  0.2376 |    0.0 |  0.0 |  0.0 |  0.2376 |  0.2376 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.950491 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -34.934403 |      0.0 |
    | 01.01. 16:00 |  0.0 | 25.9 | 24.9 |  1.829834 |  26.5 | 26.5 |      1.0 | 1.1 | 0.0 |     0.0 |  2.122607 | 1.528277 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.528277 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -36.46268 |      0.0 |
    | 01.01. 17:00 |  0.0 | 23.7 | 22.7 |  1.136569 |  24.3 | 24.3 |      1.0 | 1.1 | 0.0 |     0.0 |   1.31842 | 0.949262 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.949262 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -37.411942 |      0.0 |
    | 01.01. 18:00 |  1.3 | 21.6 | 20.6 |  0.750986 |  22.2 | 22.2 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.871144 | 0.537465 | 0.0 |  1.5444 |    0.0 |  0.0 |  0.0 |  1.5444 |  1.5444 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.537465 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -36.405007 |      0.0 |
    | 01.01. 19:00 |  5.6 | 21.2 | 20.2 |  0.223895 |  21.8 | 21.8 |      1.0 | 1.1 | 0.0 |  6.6528 |  0.259718 | 0.096141 | 0.0 |  6.6528 |    0.0 |  0.0 |  0.0 |  6.6528 |  6.6528 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.096141 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -29.848348 |      0.0 |
    | 01.01. 20:00 |  2.9 | 20.4 | 19.4 |  0.099425 |  21.0 | 21.0 |      1.0 | 1.1 | 0.0 |  3.4452 |  0.115333 | 0.058839 | 0.0 |  3.4452 |    0.0 |  0.0 |  0.0 |  3.4452 |  3.4452 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.058839 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -26.461986 |      0.0 |
    | 01.01. 21:00 |  4.9 | 19.8 | 18.8 |  0.098454 |  20.4 | 20.4 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.114207 | 0.045942 | 0.0 |  5.8212 |    0.0 |  0.0 |  0.0 |  5.8212 |  5.8212 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.045942 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | -20.686729 |      0.0 |
    | 01.01. 22:00 | 10.6 | 19.6 | 18.6 |  0.098128 |  20.2 | 20.2 |      1.0 | 1.1 | 0.0 | 12.5928 |  0.113828 | 0.023264 | 0.0 | 12.5928 |    0.0 |  0.0 |  0.0 | 12.5928 | 12.5928 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.023264 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -8.117193 |      0.0 |
    | 01.01. 23:00 |  0.1 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.1188 |   0.11307 | 0.080449 | 0.0 |  0.1188 |    0.0 |  0.0 |  0.0 |  0.1188 |  0.1188 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.080449 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -8.078842 |      0.0 |
    | 02.01. 00:00 |  0.7 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.8316 |   0.11307 | 0.074914 | 0.0 |  0.8316 |    0.0 |  0.0 |  0.0 |  0.8316 |  0.8316 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.074914 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -7.322156 |      0.0 |
    | 02.01. 01:00 |  3.0 | 19.2 | 18.2 |  0.097474 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |   3.564 |   0.11307 | 0.057003 | 0.0 |   3.564 |    0.0 |  0.0 |  0.0 |   3.564 |   3.564 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.057003 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -3.815158 |      0.0 |
    | 02.01. 02:00 |  2.1 | 18.9 | 17.9 |  0.096981 |  19.5 | 19.5 |      1.0 | 1.1 | 0.0 |  2.4948 |  0.112498 | 0.063115 | 0.0 |  2.4948 |    0.0 |  0.0 |  0.0 |  2.4948 |  2.4948 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.063115 |      0.0 |      0.0 |      0.0 |      0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  -1.383473 |      0.0 |
    | 02.01. 03:00 | 10.4 | 18.7 | 17.7 |  0.096652 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 | 12.3552 |  0.112116 | 0.023465 | 0.0 | 12.3552 |    0.0 |  0.0 |  0.0 | 12.3552 | 12.3552 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.023465 | 0.054741 | 0.054741 | 0.012165 | 0.002165 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  10.893521 | 0.000601 |
    | 02.01. 04:00 |  3.5 | 18.5 | 17.5 |  0.096321 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |   4.158 |  0.111732 |  0.05308 | 0.0 |   4.158 |    0.0 |  0.0 |  0.0 |   4.158 |   4.158 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.05308 | 0.074992 | 0.074992 | 0.047077 | 0.037077 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  14.923448 | 0.010299 |
    | 02.01. 05:00 |  3.4 | 18.3 | 17.3 |   0.09599 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |  4.0392 |  0.111348 |  0.05353 | 0.0 |  4.0392 |    0.0 |  0.0 |  0.0 |  4.0392 |  4.0392 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.05353 | 0.094546 | 0.094546 | 0.074837 | 0.064837 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  18.814573 |  0.01801 |
    | 02.01. 06:00 |  1.2 | 18.5 | 17.5 |  0.187298 |  19.1 | 19.1 |      1.0 | 1.1 | 0.0 |  1.4256 |  0.217266 | 0.135647 | 0.0 |  1.4256 |    0.0 |  0.0 |  0.0 |  1.4256 |  1.4256 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.135647 | 0.100523 | 0.100523 | 0.091529 | 0.081529 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  20.004003 | 0.022647 |
    | 02.01. 07:00 |  0.1 | 18.8 | 17.8 |  1.264612 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  0.1188 |   1.46695 |  1.04373 | 0.0 |  0.1188 |    0.0 |  0.0 |  0.0 |  0.1188 |  0.1188 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  1.04373 | 0.095395 | 0.095395 | 0.098055 | 0.088055 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  18.983677 |  0.02446 |
    | 02.01. 08:00 |  0.0 | 18.8 | 17.8 |  3.045538 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |     0.0 |  3.532824 | 2.543633 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 2.543633 |   0.0822 |   0.0822 | 0.093603 | 0.083603 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  16.357844 | 0.023223 |
    | 02.01. 09:00 |  0.0 | 19.0 | 18.0 |  1.930758 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |     0.0 |  2.239679 | 1.612569 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.612569 | 0.073726 | 0.073726 | 0.083249 | 0.073249 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  14.671548 | 0.020347 |
    | 02.01. 10:00 |  0.4 | 19.2 | 18.2 |  2.461001 |  19.8 | 19.8 |      1.0 | 1.1 | 0.0 |  0.4752 |  2.854761 | 1.960038 | 0.0 |  0.4752 |    0.0 |  0.0 |  0.0 |  0.4752 |  0.4752 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.960038 | 0.065934 | 0.065934 | 0.073878 | 0.063878 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  13.120776 | 0.017744 |
    | 02.01. 11:00 |  0.1 | 19.3 | 18.3 |  6.215945 |  19.9 | 19.9 |      1.0 | 1.1 | 0.0 |  0.1188 |  7.210496 | 5.130246 | 0.0 |  0.1188 |    0.0 |  0.0 |  0.0 |  0.1188 |  0.1188 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 5.130246 | 0.040547 | 0.040547 | 0.062024 | 0.052024 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   8.068783 | 0.014451 |
    | 02.01. 12:00 |  3.6 | 19.0 | 18.0 |  3.374783 |  19.6 | 19.6 |      1.0 | 1.1 | 0.0 |  4.2768 |  3.914748 | 1.837796 | 0.0 |  4.2768 |    0.0 |  0.0 |  0.0 |  4.2768 |  4.2768 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.837796 | 0.052539 | 0.052539 | 0.048853 | 0.038853 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  10.455248 | 0.010793 |
    | 02.01. 13:00 |  5.9 | 18.8 | 17.8 |  8.821555 |  19.4 | 19.4 |      1.0 | 1.1 | 0.0 |  7.0092 | 10.233004 | 3.655358 | 0.0 |  7.0092 |    0.0 |  0.0 |  0.0 |  7.0092 |  7.0092 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 3.655358 | 0.069045 | 0.069045 | 0.053542 | 0.043542 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  13.740045 | 0.012095 |
    | 02.01. 14:00 |  1.1 | 18.7 | 17.7 |  4.046025 |  19.3 | 19.3 |      1.0 | 1.1 | 0.0 |  1.3068 |  4.693389 | 2.965278 | 0.0 |  1.3068 |    0.0 |  0.0 |  0.0 |  1.3068 |  1.3068 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 2.965278 | 0.060408 | 0.060408 | 0.063458 | 0.053458 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  12.021159 | 0.014849 |
    | 02.01. 15:00 | 20.7 | 17.8 | 16.8 |  2.110757 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 | 24.5916 |  2.448478 |  0.15074 | 0.0 | 24.5916 |    0.0 |  0.0 |  0.0 | 24.5916 | 24.5916 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.15074 |  0.18231 |  0.18231 | 0.089417 | 0.079417 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  36.279708 |  0.02206 |
    | 02.01. 16:00 | 37.9 | 17.4 | 16.4 |  2.239257 |  18.0 | 18.0 |      1.0 | 1.1 | 0.0 | 45.0252 |  2.597538 | 0.020724 | 0.0 | 45.0252 |    0.0 |  0.0 |  0.0 | 45.0252 | 45.0252 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.020724 | 0.406421 | 0.406421 | 0.205023 | 0.195023 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  80.877763 | 0.054173 |
    | 02.01. 17:00 |  8.2 | 17.3 | 16.3 |  2.877848 |  17.9 | 17.9 |      1.0 | 1.1 | 0.0 |  9.7416 |  3.338304 | 0.907373 | 0.0 |  9.7416 |    0.0 |  0.0 |  0.0 |  9.7416 |  9.7416 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.907373 |  0.44856 |  0.44856 | 0.365983 | 0.355983 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   89.26343 | 0.098884 |
    | 02.01. 18:00 |  3.6 | 16.8 | 15.8 |  1.591452 |  17.4 | 17.4 |      1.0 | 1.1 | 0.0 |  4.2768 |  1.846084 | 0.866652 | 0.0 |  4.2768 |    0.0 |  0.0 |  0.0 |  4.2768 |  4.2768 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.866652 | 0.463368 | 0.463368 | 0.442486 | 0.432486 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   92.21021 | 0.120135 |
    | 02.01. 19:00 |  7.5 | 16.5 | 15.5 |  0.291604 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |    8.91 |  0.338261 | 0.099914 | 0.0 |    8.91 |    0.0 |  0.0 |  0.0 |    8.91 |    8.91 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.099914 | 0.505101 | 0.505101 | 0.469351 | 0.459351 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.515194 | 0.127598 |
    | 02.01. 20:00 | 18.5 | 16.3 | 15.3 |  0.092622 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  21.978 |  0.107442 |  0.00859 | 0.0 |  21.978 |    0.0 |  0.0 |  0.0 |  21.978 |  21.978 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.00859 | 0.612423 | 0.612423 | 0.519677 | 0.509677 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  121.87218 | 0.141577 |
    | 02.01. 21:00 | 15.4 | 16.2 | 15.2 |  0.092451 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 | 18.2952 |  0.107243 | 0.012392 | 0.0 | 18.2952 |    0.0 |  0.0 |  0.0 | 18.2952 | 18.2952 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.012392 | 0.700775 | 0.700775 | 0.608208 | 0.598208 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 139.454213 | 0.166169 |
    | 02.01. 22:00 |  6.3 | 15.5 | 14.5 |  0.091248 |  16.1 | 16.1 |      1.0 | 1.1 | 0.0 |  7.4844 |  0.105848 | 0.036055 | 0.0 |  7.4844 |    0.0 |  0.0 |  0.0 |  7.4844 |  7.4844 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.036055 | 0.734513 | 0.734513 | 0.688638 | 0.678638 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 146.168045 | 0.188511 |
    | 02.01. 23:00 |  1.9 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  2.2572 |  0.104032 | 0.059768 | 0.0 |  2.2572 |    0.0 |  0.0 |  0.0 |  2.2572 |  2.2572 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.059768 | 0.741827 | 0.741827 | 0.728641 | 0.718641 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 147.623649 | 0.199622 |
    | 03.01. 00:00 |  4.9 | 14.7 | 13.7 |  0.089858 |  15.3 | 15.3 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.104235 | 0.041931 | 0.0 |  5.8212 |    0.0 |  0.0 |  0.0 |  5.8212 |  5.8212 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.041931 | 0.767015 | 0.767015 | 0.745799 | 0.735799 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 152.635904 | 0.204389 |
    | 03.01. 01:00 |  2.7 | 14.6 | 13.6 |  0.089683 |  15.2 | 15.2 |      1.0 | 1.1 | 0.0 |  3.2076 |  0.104032 |  0.05435 | 0.0 |  3.2076 |    0.0 |  0.0 |  0.0 |  3.2076 |  3.2076 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.05435 | 0.778946 | 0.778946 | 0.764069 | 0.754069 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 155.010208 | 0.209464 |
    | 03.01. 02:00 |  0.5 | 14.1 | 13.1 |  0.088805 |  14.7 | 14.7 |      1.0 | 1.1 | 0.0 |   0.594 |  0.103014 | 0.069893 | 0.0 |   0.594 |    0.0 |  0.0 |  0.0 |   0.594 |   0.594 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.069893 | 0.777672 | 0.777672 | 0.776011 | 0.766011 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 154.756644 | 0.212781 |
    | 03.01. 03:00 |  0.2 | 14.3 | 13.3 |  0.089157 |  14.9 | 14.9 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.103422 | 0.072716 | 0.0 |  0.2376 |    0.0 |  0.0 |  0.0 |  0.2376 |  0.2376 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.072716 | 0.774608 | 0.774608 | 0.777274 | 0.767274 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 154.146921 | 0.213132 |
    | 03.01. 04:00 |  0.5 | 14.9 | 13.9 |  0.090207 |  15.5 | 15.5 |      1.0 | 1.1 | 0.0 |   0.594 |   0.10464 | 0.070996 | 0.0 |   0.594 |    0.0 |  0.0 |  0.0 |   0.594 |   0.594 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.070996 |  0.77335 |  0.77335 | 0.775009 | 0.765009 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 153.896575 | 0.212502 |
    | 03.01. 05:00 |  2.4 | 15.7 | 14.7 |  0.091593 |  16.3 | 16.3 |      1.0 | 1.1 | 0.0 |  2.8512 |  0.106248 | 0.057521 | 0.0 |  2.8512 |    0.0 |  0.0 |  0.0 |  2.8512 |  2.8512 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.057521 | 0.783451 | 0.783451 | 0.775874 | 0.765874 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 155.906803 | 0.212743 |
    | 03.01. 06:00 |  0.4 | 16.0 | 15.0 |  0.154861 |  16.6 | 16.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  0.179639 | 0.123337 | 0.0 |  0.4752 |    0.0 |  0.0 |  0.0 |  0.4752 |  0.4752 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.123337 | 0.781293 | 0.781293 | 0.780727 | 0.770727 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 155.477372 | 0.214091 |
    | 03.01. 07:00 |  0.2 | 16.7 | 15.7 |  0.470369 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.545628 | 0.383628 | 0.0 |  0.2376 |    0.0 |  0.0 |  0.0 |  0.2376 |  0.2376 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.383628 | 0.776657 | 0.776657 | 0.780743 | 0.770743 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 154.554688 | 0.214095 |
    | 03.01. 08:00 |  0.0 | 17.1 | 16.1 |  1.173726 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  1.361522 | 0.980296 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.980296 | 0.767872 | 0.767872 | 0.775735 | 0.765735 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  152.80652 | 0.212704 |
    | 03.01. 09:00 |  0.0 | 16.2 | 15.2 |  4.202296 |  16.8 | 16.8 |      1.0 | 1.1 | 0.0 |     0.0 |  4.874663 | 3.509758 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 3.509758 | 0.746484 | 0.746484 | 0.765071 | 0.755071 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 148.550278 | 0.209742 |
    | 03.01. 10:00 |  0.3 | 15.9 | 14.9 |  4.359715 |  16.5 | 16.5 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.057269 | 3.513746 | 0.0 |  0.3564 |    0.0 |  0.0 |  0.0 |  0.3564 |  0.3564 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 3.513746 | 0.726965 | 0.726965 | 0.746899 | 0.736899 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 144.665968 | 0.204694 |
    | 03.01. 11:00 |  2.6 | 16.3 | 15.3 |  5.305753 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  3.0888 |  6.154673 | 3.253813 | 0.0 |  3.0888 |    0.0 |  0.0 |  0.0 |  3.0888 |  3.0888 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 3.253813 | 0.722505 | 0.722505 | 0.730311 | 0.720311 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  143.77845 | 0.200086 |
    | 03.01. 12:00 |  0.7 | 16.3 | 15.3 |  5.376027 |  16.9 | 16.9 |      1.0 | 1.1 | 0.0 |  0.8316 |  6.236191 | 4.131769 | 0.0 |  0.8316 |    0.0 |  0.0 |  0.0 |  0.8316 |  0.8316 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 4.131769 | 0.702391 | 0.702391 | 0.719026 | 0.709026 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  139.77589 | 0.196952 |
    | 03.01. 13:00 |  0.3 | 16.4 | 15.4 |  4.658915 |  17.0 | 17.0 |      1.0 | 1.1 | 0.0 |  0.3564 |  5.404341 | 3.754888 | 0.0 |  0.3564 |    0.0 |  0.0 |  0.0 |  0.3564 |  0.3564 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 3.754888 | 0.681887 | 0.681887 | 0.702305 | 0.692305 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 135.695514 | 0.192307 |
    | 03.01. 14:00 |  0.3 | 16.5 | 15.5 |  7.789594 |  17.1 | 17.1 |      1.0 | 1.1 | 0.0 |  0.3564 |  9.035929 | 6.278083 | 0.0 |  0.3564 |    0.0 |  0.0 |  0.0 |  0.3564 |  0.3564 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 6.278083 | 0.648869 | 0.648869 | 0.679106 | 0.669106 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 129.124962 | 0.185863 |
    | 03.01. 15:00 |  0.0 | 18.4 | 17.4 |  4.851567 |  19.0 | 19.0 |      1.0 | 1.1 | 0.0 |     0.0 |  5.627818 | 4.052029 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 4.052029 | 0.625365 | 0.625365 | 0.650983 | 0.640983 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 124.447569 | 0.178051 |
    | 03.01. 16:00 |  0.0 | 18.3 | 17.3 |   5.30692 |  18.9 | 18.9 |      1.0 | 1.1 | 0.0 |     0.0 |  6.156027 |  4.43234 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  4.43234 | 0.600076 | 0.600076 | 0.624968 | 0.614968 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 119.415153 | 0.170825 |
    | 03.01. 17:00 |  0.0 | 18.1 | 17.1 |  3.286036 |  18.7 | 18.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.811802 | 2.744497 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 2.744497 | 0.583353 | 0.583353 |  0.60198 |  0.59198 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 116.087303 | 0.164439 |
    | 03.01. 18:00 |  0.0 | 16.7 | 15.7 |  1.506216 |  17.3 | 17.3 |      1.0 | 1.1 | 0.0 |     0.0 |  1.747211 | 1.257992 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.257992 | 0.574147 | 0.574147 | 0.585024 | 0.575024 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 114.255164 | 0.159729 |
    | 03.01. 19:00 |  0.0 | 15.2 | 14.2 |  0.274762 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.318724 | 0.229481 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.229481 | 0.570128 | 0.570128 |   0.5753 |   0.5653 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 113.455555 | 0.157028 |
    | 03.01. 20:00 |  0.0 | 13.4 | 12.4 |  0.087565 |  14.0 | 14.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.101575 | 0.073134 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.073134 | 0.566912 | 0.566912 | 0.570307 | 0.560307 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 112.815508 | 0.155641 |
    | 03.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.564078 | 0.564078 | 0.566997 | 0.556997 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 112.251431 | 0.154721 |
    | 03.01. 22:00 |  0.0 | 11.6 | 10.6 |  0.084317 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |     0.0 |  0.097808 | 0.070422 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.561257 | 0.561257 | 0.564081 | 0.554081 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 111.690174 | 0.153911 |
    | 03.01. 23:00 |  0.0 | 11.0 | 10.0 |  0.083215 |  11.6 | 11.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096529 | 0.069501 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.558451 | 0.558451 |  0.56126 |  0.55126 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 111.131723 | 0.153128 |
    | 04.01. 00:00 |  0.0 | 10.5 |  9.5 |  0.082289 |  11.1 | 11.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.095455 | 0.068728 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.555659 | 0.555659 | 0.558454 | 0.548454 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 110.576064 | 0.152348 |
    | 04.01. 01:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 |  0.55288 |  0.55288 | 0.555662 | 0.545662 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 110.023184 | 0.151573 |
    | 04.01. 02:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.550116 | 0.550116 | 0.552883 | 0.542883 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 109.473068 | 0.150801 |
    | 04.01. 03:00 |  1.3 | 11.2 | 10.2 |  0.083584 |  11.8 | 11.8 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.096957 | 0.059819 | 0.0 |  1.5444 |    0.0 |  0.0 |  0.0 |  1.5444 |  1.5444 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.555087 | 0.555087 | 0.551835 | 0.541835 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 110.462381 |  0.15051 |
    | 04.01. 04:00 |  0.0 | 11.1 | 10.1 |    0.0834 |  11.7 | 11.7 |      1.0 | 1.1 | 0.0 |     0.0 |  0.096744 | 0.069656 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.552312 | 0.552312 | 0.553366 | 0.543366 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 109.910069 | 0.150935 |
    | 04.01. 05:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 |  0.54955 |  0.54955 | 0.552315 | 0.542315 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 109.360518 | 0.150643 |
    | 04.01. 06:00 |  0.0 | 12.2 | 11.2 |  0.310229 |  12.8 | 12.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.359866 | 0.259103 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.546803 | 0.546803 | 0.549553 | 0.539553 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 108.813716 | 0.149876 |
    | 04.01. 07:00 |  0.7 | 11.8 | 10.8 |  1.391958 |  12.4 | 12.4 |      1.0 | 1.1 | 0.0 |  0.8316 |  1.614671 | 1.069795 | 0.0 |  0.8316 |    0.0 |  0.0 |  0.0 |  0.8316 |  0.8316 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.548227 | 0.548227 |  0.54773 |  0.53773 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 109.097089 | 0.149369 |
    | 04.01. 08:00 |  0.4 | 11.4 | 10.4 |  3.195876 |  12.0 | 12.0 |      1.0 | 1.1 | 0.0 |  0.4752 |  3.707216 | 2.545322 | 0.0 |  0.4752 |    0.0 |  0.0 |  0.0 |  0.4752 |  0.4752 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.547861 | 0.547861 | 0.547829 | 0.537829 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 109.024428 | 0.149397 |
    | 04.01. 09:00 |  0.1 | 11.6 | 10.6 |  5.191651 |  12.2 | 12.2 |      1.0 | 1.1 | 0.0 |  0.1188 |  6.022315 | 4.284859 | 0.0 |  0.1188 |    0.0 |  0.0 |  0.0 |  0.1188 |  0.1188 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.545716 | 0.545716 | 0.547466 | 0.537466 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 108.597512 | 0.149296 |
    | 04.01. 10:00 |  0.4 | 13.0 | 12.0 |  7.155036 |  13.6 | 13.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  8.299842 | 5.698554 | 0.0 |  0.4752 |    0.0 |  0.0 |  0.0 |  0.4752 |  0.4752 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 5.698554 | 0.516871 | 0.516871 | 0.539783 | 0.529783 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 102.857287 | 0.147162 |
    | 04.01. 11:00 |  0.0 | 17.1 | 16.1 |  8.391432 |  17.7 | 17.7 |      1.0 | 1.1 | 0.0 |     0.0 |  9.734061 | 7.008524 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 7.008524 | 0.479244 | 0.479244 | 0.514919 | 0.504919 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  95.369519 | 0.140255 |
    | 04.01. 12:00 |  0.0 | 18.2 | 17.2 |  8.391286 |  18.8 | 18.8 |      1.0 | 1.1 | 0.0 |     0.0 |  9.733892 | 7.008402 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 7.008402 | 0.441806 | 0.441806 | 0.479286 | 0.469286 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  87.919312 | 0.130357 |
    | 04.01. 13:00 |  0.0 | 22.4 | 21.4 | 10.715238 |  23.0 | 23.0 |      1.0 | 1.1 | 0.0 |     0.0 | 12.429676 | 8.949367 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 8.949367 |  0.39485 |  0.39485 | 0.439691 | 0.429691 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  78.575095 | 0.119358 |
    | 04.01. 14:00 |  0.0 | 21.4 | 20.4 |  9.383394 |  22.0 | 22.0 |      1.0 | 1.1 | 0.0 |     0.0 | 10.884737 | 7.837011 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 7.837011 |  0.35369 |  0.35369 | 0.396138 | 0.386138 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  70.384394 | 0.107261 |
    | 04.01. 15:00 |  0.0 | 21.8 | 20.8 |  7.861915 |  22.4 | 22.4 |      1.0 | 1.1 | 0.0 |     0.0 |  9.119821 | 6.566271 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 6.566271 | 0.319091 | 0.319091 | 0.355148 | 0.345148 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  63.499032 | 0.095874 |
    | 04.01. 16:00 |  0.0 | 22.2 | 21.2 |  6.298329 |  22.8 | 22.8 |      1.0 | 1.1 | 0.0 |     0.0 |  7.306062 | 5.260364 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 5.260364 | 0.291193 | 0.291193 |  0.32058 |  0.31058 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  57.947474 | 0.086272 |
    | 04.01. 17:00 |  0.0 | 20.1 | 19.1 |  2.948416 |  20.7 | 20.7 |      1.0 | 1.1 | 0.0 |     0.0 |  3.420163 | 2.462517 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 2.462517 | 0.277425 | 0.277425 | 0.294333 | 0.284333 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  55.207533 | 0.078981 |
    | 04.01. 18:00 |  0.0 | 17.8 | 16.8 |  1.309232 |  18.4 | 18.4 |      1.0 | 1.1 | 0.0 |     0.0 |  1.518709 | 1.093471 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 1.093471 |  0.27057 |  0.27057 | 0.278961 | 0.268961 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  53.843492 | 0.074711 |
    | 04.01. 19:00 |  0.0 | 15.2 | 14.2 |   0.32955 |  15.8 | 15.8 |      1.0 | 1.1 | 0.0 |     0.0 |  0.382278 |  0.27524 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |  0.27524 | 0.267841 | 0.267841 | 0.271487 | 0.261487 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |   53.30041 | 0.072635 |
    | 04.01. 20:00 |  0.0 | 14.5 | 13.5 |  0.089508 |  15.1 | 15.1 |      1.0 | 1.1 | 0.0 |     0.0 |  0.103829 | 0.074757 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 | 0.074757 | 0.266128 | 0.266128 | 0.268067 | 0.258067 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  52.959525 | 0.071685 |
    | 04.01. 21:00 |  0.0 | 12.4 | 11.4 |  0.085771 |  13.0 | 13.0 |      1.0 | 1.1 | 0.0 |     0.0 |  0.099494 | 0.071636 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.264798 | 0.264798 | 0.266213 | 0.256213 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  52.694727 |  0.07117 |
    | 04.01. 22:00 |  0.0 | 11.7 | 10.7 |    0.0845 |  12.3 | 12.3 |      1.0 | 1.1 | 0.0 |     0.0 |   0.09802 | 0.070574 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.263474 | 0.263474 | 0.264799 | 0.254799 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  52.431254 | 0.070778 |
    | 04.01. 23:00 |  0.0 | 11.9 | 10.9 |  0.084864 |  12.5 | 12.5 |      1.0 | 1.1 | 0.0 |     0.0 |  0.098442 | 0.070878 | 0.0 |     0.0 |    0.0 |  0.0 |  0.0 |     0.0 |     0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |  0.0 | 0.0 |      0.0 | 0.262156 | 0.262156 | 0.263475 | 0.253475 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |  52.169097 |  0.07041 |

    .. raw:: html

        <iframe
            src="hland_v1_ex4.html"
            width="100%"
            height="930px"
            frameborder=0
        ></iframe>

    .. _hland_v1_ex5:

    **Example 5**

    This example demonstrates the functionality of zones of type |GLACIER|.
    |GLACIER| zones are similar to zones of type |FIELD| or |FOREST|, but
    possess neither an interception storage nor a soil storage.  Instead,
    all precipitation or melting water is passed to the upper zone storage
    (|UZ|) directly. The snow routines of |GLACIER|, |FIELD|, and |FOREST|
    zones are identical.  Additional glacier melt can only occur if the
    glacier is not covered by any snow.  In the following test run,
    the simulation time period can be distinguished into three subperiods.
    On the first two days (-20°C), the snow layer builds up.  On the third
    day (+20°C and |SP| > 0), the snow melts and (with some time delay)
    the melted water is released. On the fourth day (+20°C and |SP| = 0),
    an increased amount of water is passed to |UZ|, as |GMelt| is set to
    a larger value than |CFMax|:

    >>> zonetype(GLACIER)
    >>> parameters.update()
    >>> inputs.t.series[:48] = -20.0
    >>> inputs.t.series[48:] = 20.0
    >>> inputs.tn.series = inputs.t.series
    >>> test('hland_v1_ex5')
    |         date |    p |     t |    tn |       epn | tmean |    tc | fracrain | rfc | sfc |      pc |        ep |      epc |  ei |      tf | glmelt |   melt | refr |      in_ |        r |  ea | cfpot |  cf | perc | contriarea |     inuz |        q0 |  el |       q1 |      inuh |     outuh |        qt |  ic |       sp |       wc |  sm |        uz |        lz |   outlet |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. 00:00 |  0.0 | -20.0 | -20.0 |  0.100707 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  0.106749 |  0.07686 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 |     0.05 |      0.05 |  0.061111 |  0.051111 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |      9.95 | 0.014198 |
    | 01.01. 01:00 |  0.0 | -20.0 | -20.0 |  0.097801 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  0.103669 | 0.074642 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 |  0.04975 |   0.04975 |  0.088833 |  0.078833 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |   9.90025 | 0.021898 |
    | 01.01. 02:00 |  0.0 | -20.0 | -20.0 |  0.096981 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |    0.1028 | 0.074016 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.049501 |  0.049501 |   0.04975 |   0.03975 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.850749 | 0.011042 |
    | 01.01. 03:00 |  0.0 | -20.0 | -20.0 |   0.09599 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  0.101749 |  0.07326 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.049254 |  0.049254 |  0.049502 |  0.039502 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.801495 | 0.010973 |
    | 01.01. 04:00 |  0.0 | -20.0 | -20.0 |  0.096981 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |    0.1028 | 0.074016 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.049007 |  0.049007 |  0.049254 |  0.039254 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.752488 | 0.010904 |
    | 01.01. 05:00 |  0.0 | -20.0 | -20.0 |  0.102761 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  0.108927 | 0.078427 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.048762 |  0.048762 |  0.049008 |  0.039008 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.703725 | 0.010835 |
    | 01.01. 06:00 |  0.0 | -20.0 | -20.0 |  0.291908 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  0.309422 | 0.222784 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.048519 |  0.048519 |  0.048763 |  0.038763 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.655206 | 0.010767 |
    | 01.01. 07:00 |  0.0 | -20.0 | -20.0 |  1.932875 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  2.048847 |  1.47517 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.048276 |  0.048276 |  0.048519 |  0.038519 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |   9.60693 |   0.0107 |
    | 01.01. 08:00 |  0.0 | -20.0 | -20.0 |  4.369536 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  4.631708 |  3.33483 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.048035 |  0.048035 |  0.048276 |  0.038276 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.558896 | 0.010632 |
    | 01.01. 09:00 |  0.0 | -20.0 | -20.0 |  7.317556 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  7.756609 | 5.584759 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.047794 |  0.047794 |  0.048035 |  0.038035 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.511101 | 0.010565 |
    | 01.01. 10:00 |  0.0 | -20.0 | -20.0 |  8.264362 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  8.760224 | 6.307361 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.047556 |  0.047556 |  0.047795 |  0.037795 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.463546 | 0.010499 |
    | 01.01. 11:00 |  0.0 | -20.0 | -20.0 |  9.369867 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  9.932059 | 7.151082 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.047318 |  0.047318 |  0.047556 |  0.037556 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.416228 | 0.010432 |
    | 01.01. 12:00 |  0.0 | -20.0 | -20.0 |  5.126178 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  5.433749 | 3.912299 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.047081 |  0.047081 |  0.047318 |  0.037318 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.369147 | 0.010366 |
    | 01.01. 13:00 |  0.0 | -20.0 | -20.0 |   6.62503 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  7.022532 | 5.056223 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.046846 |  0.046846 |  0.047081 |  0.037081 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |  9.322301 |   0.0103 |
    | 01.01. 14:00 |  0.0 | -20.0 | -20.0 |  7.397619 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  7.841476 | 5.645863 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.046612 |  0.046612 |  0.046846 |  0.036846 | 0.0 |      0.0 |      0.0 | 0.0 |       0.0 |   9.27569 | 0.010235 |
    | 01.01. 15:00 |  0.2 | -20.0 | -20.0 |   2.39151 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  0.2808 |  2.535001 | 1.774662 | 0.0 |  0.2808 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.046378 |  0.046378 |  0.046612 |  0.036612 | 0.0 |   0.2808 |      0.0 | 0.0 |       0.0 |  9.229311 |  0.01017 |
    | 01.01. 16:00 |  0.0 | -20.0 | -20.0 |  1.829834 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  1.939624 | 1.396529 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.046147 |  0.046147 |  0.046379 |  0.036379 | 0.0 |   0.2808 |      0.0 | 0.0 |       0.0 |  9.183165 | 0.010105 |
    | 01.01. 17:00 |  0.0 | -20.0 | -20.0 |  1.136569 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  1.204763 | 0.867429 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.045916 |  0.045916 |  0.046147 |  0.036147 | 0.0 |   0.2808 |      0.0 | 0.0 |       0.0 |  9.137249 | 0.010041 |
    | 01.01. 18:00 |  1.3 | -20.0 | -20.0 |  0.750986 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  1.8252 |  0.796045 | 0.477532 | 0.0 |  1.8252 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.045686 |  0.045686 |  0.045916 |  0.035916 | 0.0 |    2.106 |      0.0 | 0.0 |       0.0 |  9.091563 | 0.009977 |
    | 01.01. 19:00 |  5.6 | -20.0 | -20.0 |  0.223895 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  7.8624 |  0.237329 | 0.077844 | 0.0 |  7.8624 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.045458 |  0.045458 |  0.045686 |  0.035686 | 0.0 |   9.9684 |      0.0 | 0.0 |       0.0 |  9.046105 | 0.009913 |
    | 01.01. 20:00 |  2.9 | -20.0 | -20.0 |  0.099425 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  4.0716 |   0.10539 | 0.050502 | 0.0 |  4.0716 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.045231 |  0.045231 |  0.045458 |  0.035458 | 0.0 |    14.04 |      0.0 | 0.0 |       0.0 |  9.000874 | 0.009849 |
    | 01.01. 21:00 |  4.9 | -20.0 | -20.0 |  0.098454 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  6.8796 |  0.104361 | 0.037765 | 0.0 |  6.8796 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.045004 |  0.045004 |  0.045231 |  0.035231 | 0.0 |  20.9196 |      0.0 | 0.0 |       0.0 |   8.95587 | 0.009786 |
    | 01.01. 22:00 | 10.6 | -20.0 | -20.0 |  0.098128 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 | 14.8824 |  0.104016 | 0.016908 | 0.0 | 14.8824 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.044779 |  0.044779 |  0.045005 |  0.035005 | 0.0 |   35.802 |      0.0 | 0.0 |       0.0 |  8.911091 | 0.009724 |
    | 01.01. 23:00 |  0.1 | -20.0 | -20.0 |  0.097474 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  0.1404 |  0.103322 | 0.073355 | 0.0 |  0.1404 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.044555 |  0.044555 |   0.04478 |   0.03478 | 0.0 |  35.9424 |      0.0 | 0.0 |       0.0 |  8.866535 | 0.009661 |
    | 02.01. 00:00 |  0.7 | -20.0 | -20.0 |  0.097474 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  0.9828 |  0.103322 | 0.067429 | 0.0 |  0.9828 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.044333 |  0.044333 |  0.044556 |  0.034556 | 0.0 |  36.9252 |      0.0 | 0.0 |       0.0 |  8.822202 | 0.009599 |
    | 02.01. 01:00 |  3.0 | -20.0 | -20.0 |  0.097474 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |   4.212 |  0.103322 | 0.048821 | 0.0 |   4.212 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.044111 |  0.044111 |  0.044333 |  0.034333 | 0.0 |  41.1372 |      0.0 | 0.0 |       0.0 |  8.778091 | 0.009537 |
    | 02.01. 02:00 |  2.1 | -20.0 | -20.0 |  0.096981 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  2.9484 |    0.1028 | 0.055116 | 0.0 |  2.9484 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 |  0.04389 |   0.04389 |  0.044111 |  0.034111 | 0.0 |  44.0856 |      0.0 | 0.0 |       0.0 |  8.734201 | 0.009475 |
    | 02.01. 03:00 | 10.4 | -20.0 | -20.0 |  0.096652 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 | 14.6016 |  0.102451 | 0.017128 | 0.0 | 14.6016 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.043671 |  0.043671 |  0.043891 |  0.033891 | 0.0 |  58.6872 |      0.0 | 0.0 |       0.0 |   8.69053 | 0.009414 |
    | 02.01. 04:00 |  3.5 | -20.0 | -20.0 |  0.096321 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |   4.914 |    0.1021 | 0.044973 | 0.0 |   4.914 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.043453 |  0.043453 |  0.043671 |  0.033671 | 0.0 |  63.6012 |      0.0 | 0.0 |       0.0 |  8.647077 | 0.009353 |
    | 02.01. 05:00 |  3.4 | -20.0 | -20.0 |   0.09599 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  4.7736 |  0.101749 | 0.045452 | 0.0 |  4.7736 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.043235 |  0.043235 |  0.043453 |  0.033453 | 0.0 |  68.3748 |      0.0 | 0.0 |       0.0 |  8.603842 | 0.009292 |
    | 02.01. 06:00 |  1.2 | -20.0 | -20.0 |  0.187298 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  1.6848 |  0.198536 | 0.120782 | 0.0 |  1.6848 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.043019 |  0.043019 |  0.043236 |  0.033236 | 0.0 |  70.0596 |      0.0 | 0.0 |       0.0 |  8.560823 | 0.009232 |
    | 02.01. 07:00 |  0.1 | -20.0 | -20.0 |  1.264612 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  0.1404 |  1.340489 | 0.951696 | 0.0 |  0.1404 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.042804 |  0.042804 |  0.043019 |  0.033019 | 0.0 |     70.2 |      0.0 | 0.0 |       0.0 |  8.518019 | 0.009172 |
    | 02.01. 08:00 |  0.0 | -20.0 | -20.0 |  3.045538 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |   3.22827 | 2.324355 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 |  0.04259 |   0.04259 |  0.042804 |  0.032804 | 0.0 |     70.2 |      0.0 | 0.0 |       0.0 |  8.475429 | 0.009112 |
    | 02.01. 09:00 |  0.0 | -20.0 | -20.0 |  1.930758 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |     0.0 |  2.046603 | 1.473555 | 0.0 |     0.0 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.042377 |  0.042377 |   0.04259 |   0.03259 | 0.0 |     70.2 |      0.0 | 0.0 |       0.0 |  8.433051 | 0.009053 |
    | 02.01. 10:00 |  0.4 | -20.0 | -20.0 |  2.461001 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  0.5616 |  2.608661 | 1.775661 | 0.0 |  0.5616 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.042165 |  0.042165 |  0.042377 |  0.032377 | 0.0 |  70.7616 |      0.0 | 0.0 |       0.0 |  8.390886 | 0.008994 |
    | 02.01. 11:00 |  0.1 | -20.0 | -20.0 |  6.215945 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  0.1404 |  6.588902 | 4.677869 | 0.0 |  0.1404 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.041954 |  0.041954 |  0.042165 |  0.032165 | 0.0 |   70.902 |      0.0 | 0.0 |       0.0 |  8.348932 | 0.008935 |
    | 02.01. 12:00 |  3.6 | -20.0 | -20.0 |  3.374783 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  5.0544 |   3.57727 | 1.553726 | 0.0 |  5.0544 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.041745 |  0.041745 |  0.041955 |  0.031955 | 0.0 |  75.9564 |      0.0 | 0.0 |       0.0 |  8.307187 | 0.008876 |
    | 02.01. 13:00 |  5.9 | -20.0 | -20.0 |  8.821555 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  8.2836 |  9.350848 | 2.940569 | 0.0 |  8.2836 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.041536 |  0.041536 |  0.041745 |  0.031745 | 0.0 |    84.24 |      0.0 | 0.0 |       0.0 |  8.265651 | 0.008818 |
    | 02.01. 14:00 |  1.1 | -20.0 | -20.0 |  4.046025 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  1.5444 |  4.288787 | 2.646028 | 0.0 |  1.5444 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.041328 |  0.041328 |  0.041536 |  0.031536 | 0.0 |  85.7844 |      0.0 | 0.0 |       0.0 |  8.224323 |  0.00876 |
    | 02.01. 15:00 | 20.7 | -20.0 | -20.0 |  2.110757 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 | 29.0628 |  2.237402 | 0.088084 | 0.0 | 29.0628 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.041122 |  0.041122 |  0.041328 |  0.031328 | 0.0 | 114.8472 |      0.0 | 0.0 |       0.0 |  8.183201 | 0.008702 |
    | 02.01. 16:00 | 37.9 | -20.0 | -20.0 |  2.239257 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 | 53.2116 |  2.373612 | 0.008352 | 0.0 | 53.2116 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.040916 |  0.040916 |  0.041122 |  0.031122 | 0.0 | 168.0588 |      0.0 | 0.0 |       0.0 |  8.142285 | 0.008645 |
    | 02.01. 17:00 |  8.2 | -20.0 | -20.0 |  2.877848 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 | 11.5128 |  3.050519 | 0.694563 | 0.0 | 11.5128 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.040711 |  0.040711 |  0.040916 |  0.030916 | 0.0 | 179.5716 |      0.0 | 0.0 |       0.0 |  8.101574 | 0.008588 |
    | 02.01. 18:00 |  3.6 | -20.0 | -20.0 |  1.591452 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  5.0544 |  1.686939 | 0.732693 | 0.0 |  5.0544 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.040508 |  0.040508 |  0.040712 |  0.030712 | 0.0 |  184.626 |      0.0 | 0.0 |       0.0 |  8.061066 | 0.008531 |
    | 02.01. 19:00 |  7.5 | -20.0 | -20.0 |  0.291604 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |   10.53 |    0.3091 | 0.077646 | 0.0 |   10.53 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.040305 |  0.040305 |  0.040508 |  0.030508 | 0.0 |  195.156 |      0.0 | 0.0 |       0.0 |  8.020761 | 0.008474 |
    | 02.01. 20:00 | 18.5 | -20.0 | -20.0 |  0.092622 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  25.974 |  0.098179 | 0.005264 | 0.0 |  25.974 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.040104 |  0.040104 |  0.040306 |  0.030306 | 0.0 |   221.13 |      0.0 | 0.0 |       0.0 |  7.980657 | 0.008418 |
    | 02.01. 21:00 | 15.4 | -20.0 | -20.0 |  0.092451 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 | 21.6216 |  0.097998 |  0.00812 | 0.0 | 21.6216 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.039903 |  0.039903 |  0.040104 |  0.030104 | 0.0 | 242.7516 |      0.0 | 0.0 |       0.0 |  7.940753 | 0.008362 |
    | 02.01. 22:00 |  6.3 | -20.0 | -20.0 |  0.091248 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  8.8452 |  0.096723 | 0.028755 | 0.0 |  8.8452 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.039704 |  0.039704 |  0.039904 |  0.029904 | 0.0 | 251.5968 |      0.0 | 0.0 |       0.0 |   7.90105 | 0.008307 |
    | 02.01. 23:00 |  1.9 | -20.0 | -20.0 |  0.089683 | -19.4 | -19.4 |      0.0 | 0.0 | 1.3 |  2.6676 |  0.095064 |  0.05242 | 0.0 |  2.6676 |    0.0 |    0.0 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.039505 |  0.039505 |  0.039704 |  0.029704 | 0.0 | 254.2644 |      0.0 | 0.0 |       0.0 |  7.861544 | 0.008251 |
    | 03.01. 00:00 |  4.9 |  20.0 |  20.0 |  0.089858 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  5.8212 |  0.095249 | 0.038316 | 0.0 |  5.8212 |    0.0 |    9.8 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.039308 |  0.039308 |  0.039505 |  0.029505 | 0.0 | 244.4644 |  15.6212 | 0.0 |       0.0 |  7.822237 | 0.008196 |
    | 03.01. 01:00 |  2.7 |  20.0 |  20.0 |  0.089683 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  3.2076 |  0.095064 | 0.049664 | 0.0 |  3.2076 |    0.0 |    9.8 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.039111 |  0.039111 |  0.039308 |  0.029308 | 0.0 | 234.6644 |  28.6288 | 0.0 |       0.0 |  7.783126 | 0.008141 |
    | 03.01. 02:00 |  0.5 |  20.0 |  20.0 |  0.088805 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |   0.594 |  0.094133 | 0.063867 | 0.0 |   0.594 |    0.0 |    9.8 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.038916 |  0.038916 |  0.039111 |  0.029111 | 0.0 | 224.8644 |  39.0228 | 0.0 |       0.0 |   7.74421 | 0.008087 |
    | 03.01. 03:00 |  0.2 |  20.0 |  20.0 |  0.089157 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.094506 | 0.066447 | 0.0 |  0.2376 |    0.0 |    9.8 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.038721 |  0.038721 |  0.038916 |  0.028916 | 0.0 | 215.0644 |  49.0604 | 0.0 |       0.0 |  7.705489 | 0.008032 |
    | 03.01. 04:00 |  0.5 |  20.0 |  20.0 |  0.090207 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |   0.594 |  0.095619 | 0.064876 | 0.0 |   0.594 |    0.0 |    9.8 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.038527 |  0.038527 |  0.038721 |  0.028721 | 0.0 | 205.2644 |  59.4544 | 0.0 |       0.0 |  7.666961 | 0.007978 |
    | 03.01. 05:00 |  2.4 |  20.0 |  20.0 |  0.091593 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  2.8512 |  0.097089 | 0.052562 | 0.0 |  2.8512 |    0.0 |    9.8 |  0.0 |      0.0 |      0.0 | 0.0 |   nan | 0.0 |  0.0 |        1.0 |      0.0 |       0.0 | 0.0 | 0.038335 |  0.038335 |  0.038528 |  0.028528 | 0.0 | 195.4644 |  72.1056 | 0.0 |       0.0 |  7.628627 | 0.007924 |
    | 03.01. 06:00 |  0.4 |  20.0 |  20.0 |  0.154861 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  0.164153 | 0.112705 | 0.0 |  0.4752 |    0.0 |    9.8 |  0.0 |  8.11504 |  8.11504 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  8.11504 |  0.109914 | 0.0 | 0.040643 |  0.150557 |  0.063316 |  0.053316 | 0.0 | 185.6644 | 74.26576 | 0.0 |  7.505126 |  8.087984 |  0.01481 |
    | 03.01. 07:00 |  0.2 |  20.0 |  20.0 |  0.470369 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.2376 |  0.498591 | 0.350557 | 0.0 |  0.2376 |    0.0 |    9.8 |  0.0 |  13.9576 |  13.9576 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  13.9576 |  2.794687 | 0.0 |  0.04294 |  2.837627 |  0.722745 |  0.712745 | 0.0 | 175.8644 | 70.34576 | 0.0 | 18.168039 |  8.545044 | 0.197985 |
    | 03.01. 08:00 |  0.0 |  20.0 |  20.0 |  1.173726 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |   1.24415 | 0.895788 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 |  9.073105 | 0.0 | 0.045225 |  9.118331 |  3.636212 |  3.626212 | 0.0 | 166.0644 | 66.42576 | 0.0 | 22.314934 |  8.999818 | 1.007281 |
    | 03.01. 09:00 |  0.0 |  20.0 |  20.0 |  4.202296 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  4.454434 | 3.207192 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 12.252207 | 0.0 | 0.047499 | 12.299706 |  8.429591 |  8.419591 | 0.0 | 156.2644 | 62.50576 | 0.0 | 23.282727 |  9.452319 | 2.338775 |
    | 03.01. 10:00 |  0.3 |  20.0 |  20.0 |  4.359715 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.3564 |  4.621298 | 3.210837 | 0.0 |  0.3564 |    0.0 |    9.8 |  0.0 |  14.0764 |  14.0764 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  14.0764 | 13.218409 | 0.0 | 0.049762 | 13.268171 | 11.807948 | 11.797948 | 0.0 | 146.4644 | 58.58576 | 0.0 | 23.640718 |  9.902558 | 3.277208 |
    | 03.01. 11:00 |  2.6 |  20.0 |  20.0 |  5.305753 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  3.0888 |  5.624098 | 2.973312 | 0.0 |  3.0888 |    0.0 |    9.8 |  0.0 |  16.8088 |  16.8088 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  16.8088 | 14.987247 | 0.0 | 0.052013 | 15.039259 | 13.446532 | 13.436532 | 0.0 | 136.6644 | 54.66576 | 0.0 | 24.962271 | 10.350545 |  3.73237 |
    | 03.01. 12:00 |  0.7 |  20.0 |  20.0 |  5.376027 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.8316 |  5.698589 | 3.775582 | 0.0 |  0.8316 |    0.0 |    9.8 |  0.0 |  14.5516 |  14.5516 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  14.5516 | 14.862113 | 0.0 | 0.054253 | 14.916366 | 14.618374 | 14.608374 | 0.0 | 126.8644 | 50.74576 | 0.0 | 24.151758 | 10.796292 | 4.057882 |
    | 03.01. 13:00 |  0.3 |  20.0 |  20.0 |  4.658915 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.3564 |   4.93845 | 3.431191 | 0.0 |  0.3564 |    0.0 |    9.8 |  0.0 |  14.0764 |  14.0764 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  14.0764 | 13.932087 | 0.0 | 0.056481 | 13.988568 | 14.737498 | 14.727498 | 0.0 | 117.0644 | 46.82576 | 0.0 | 23.796072 | 11.239811 | 4.090972 |
    | 03.01. 14:00 |  0.3 |  20.0 |  20.0 |  7.789594 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.3564 |   8.25697 | 5.736869 | 0.0 |  0.3564 |    0.0 |    9.8 |  0.0 |  14.0764 |  14.0764 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  14.0764 | 13.638844 | 0.0 | 0.058699 | 13.697543 | 14.130073 | 14.120073 | 0.0 | 107.2644 | 42.90576 | 0.0 | 23.733628 | 11.681112 | 3.922243 |
    | 03.01. 15:00 |  0.0 |  20.0 |  20.0 |  4.851567 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  5.142661 | 3.702716 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.400255 | 0.0 | 0.060906 | 13.461161 | 13.709686 | 13.699686 | 0.0 |  97.4644 | 38.98576 | 0.0 | 23.553372 | 12.120206 | 3.805468 |
    | 03.01. 16:00 |  0.0 |  20.0 |  20.0 |   5.30692 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  5.625335 | 4.050241 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.252908 | 0.0 | 0.063101 | 13.316009 | 13.481434 | 13.471434 | 0.0 |  87.6644 | 35.06576 | 0.0 | 23.520464 | 12.557105 | 3.742065 |
    | 03.01. 17:00 |  0.0 |  20.0 |  20.0 |  3.286036 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  3.483198 | 2.507903 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.226053 | 0.0 | 0.065286 | 13.291338 | 13.342783 | 13.332783 | 0.0 |  77.8644 | 31.14576 | 0.0 | 23.514412 |  12.99182 | 3.703551 |
    | 03.01. 18:00 |  0.0 |  20.0 |  20.0 |  1.506216 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  1.596589 | 1.149544 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.221115 | 0.0 | 0.067459 | 13.288574 | 13.296206 | 13.286206 | 0.0 |  68.0644 | 27.22576 | 0.0 | 23.513297 |  13.42436 | 3.690613 |
    | 03.01. 19:00 |  0.0 |  20.0 |  20.0 |  0.274762 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.291248 | 0.209698 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.220205 | 0.0 | 0.069622 | 13.289827 | 13.289467 | 13.279467 | 0.0 |  58.2644 | 23.30576 | 0.0 | 23.513091 | 13.854739 | 3.688741 |
    | 03.01. 20:00 |  0.0 |  20.0 |  20.0 |  0.087565 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.092819 |  0.06683 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.220038 | 0.0 | 0.071774 | 13.291812 |  13.28999 |  13.27999 | 0.0 |  48.4644 | 19.38576 | 0.0 | 23.513054 | 14.282965 | 3.688886 |
    | 03.01. 21:00 |  0.0 |  20.0 |  20.0 |  0.085771 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.090917 |  0.06546 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.220007 | 0.0 | 0.073915 | 13.293922 |  13.29184 |  13.28184 | 0.0 |  38.6644 | 15.46576 | 0.0 | 23.513047 |  14.70905 |   3.6894 |
    | 03.01. 22:00 |  0.0 |  20.0 |  20.0 |  0.084317 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.089376 | 0.064351 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 | 13.220001 | 0.0 | 0.076045 | 13.296047 | 13.293925 | 13.283925 | 0.0 |  28.8644 | 11.54576 | 0.0 | 23.513045 | 15.133005 | 3.689979 |
    | 03.01. 23:00 |  0.0 |  20.0 |  20.0 |  0.083215 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.088208 |  0.06351 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 |     13.22 | 0.0 | 0.078165 | 13.298165 | 13.296045 | 13.286045 | 0.0 |  19.0644 |  7.62576 | 0.0 | 23.513045 |  15.55484 | 3.690568 |
    | 04.01. 00:00 |  0.0 |  20.0 |  20.0 |  0.082289 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.087226 | 0.062803 | 0.0 |     0.0 |    0.0 |    9.8 |  0.0 |    13.72 |    13.72 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |    13.72 |     13.22 | 0.0 | 0.080274 | 13.300274 | 13.298163 | 13.288163 | 0.0 |   9.2644 |  3.70576 | 0.0 | 23.513045 | 15.974566 | 3.691156 |
    | 04.01. 01:00 |  0.0 |  20.0 |  20.0 |    0.0845 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |   0.08957 |  0.06449 | 0.0 |     0.0 |   19.6 | 9.2644 |  0.0 | 32.57016 | 32.57016 | 0.0 |   nan | 0.0 |  0.5 |        1.0 | 32.57016 | 24.610649 | 0.0 | 0.082373 | 24.693022 | 15.831527 | 15.821527 | 0.0 |      0.0 |      0.0 | 0.0 | 30.972556 | 16.392193 | 4.394869 |
    | 04.01. 02:00 |  0.0 |  20.0 |  20.0 |  0.084864 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.089956 | 0.064768 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 23.093168 | 0.0 | 0.084461 | 23.177629 | 21.824546 | 21.814546 | 0.0 |      0.0 |      0.0 | 0.0 | 26.979388 | 16.807732 | 6.059596 |
    | 04.01. 03:00 |  1.3 |  20.0 |  20.0 |  0.083584 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  1.5444 |  0.088599 | 0.054662 | 0.0 |  1.5444 |   19.6 |    0.0 |  0.0 |  21.1444 |  21.1444 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  21.1444 | 20.422967 | 0.0 | 0.086539 | 20.509506 | 22.921467 | 22.911467 | 0.0 |      0.0 |      0.0 | 0.0 | 27.200821 | 17.221193 | 6.364296 |
    | 04.01. 04:00 |  0.0 |  20.0 |  20.0 |    0.0834 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.088404 | 0.063651 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.687024 | 0.0 | 0.088606 |  19.77563 | 20.939339 | 20.929339 | 0.0 |      0.0 |      0.0 | 0.0 | 26.613797 | 17.632587 | 5.813705 |
    | 04.01. 05:00 |  0.0 |  20.0 |  20.0 |  0.084864 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.089956 | 0.064768 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.165589 | 0.0 | 0.090663 | 19.256252 | 19.823296 | 19.813296 | 0.0 |      0.0 |      0.0 | 0.0 | 26.548208 | 18.041924 | 5.503693 |
    | 04.01. 06:00 |  0.0 |  20.0 |  20.0 |  0.310229 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.328843 | 0.236767 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.107491 | 0.0 |  0.09271 | 19.200201 | 19.359213 | 19.349213 | 0.0 |      0.0 |      0.0 | 0.0 | 26.540717 | 18.449215 | 5.374781 |
    | 04.01. 07:00 |  0.7 |  20.0 |  20.0 |  1.391958 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.8316 |  1.475475 | 0.977572 | 0.0 |  0.8316 |   19.6 |    0.0 |  0.0 |  20.4316 |  20.4316 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  20.4316 | 19.599069 | 0.0 | 0.094746 | 19.693815 | 19.322348 | 19.312348 | 0.0 |      0.0 |      0.0 | 0.0 | 26.873248 | 18.854469 | 5.364541 |
    | 04.01. 08:00 |  0.4 |  20.0 |  20.0 |  3.195876 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  3.387629 | 2.325898 | 0.0 |  0.4752 |   19.6 |    0.0 |  0.0 |  20.0752 |  20.0752 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  20.0752 | 19.680557 | 0.0 | 0.096772 |  19.77733 | 19.602682 | 19.592682 | 0.0 |      0.0 |      0.0 | 0.0 | 26.767891 | 19.257696 | 5.442412 |
    | 04.01. 09:00 |  0.1 |  20.0 |  20.0 |  5.191651 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.1188 |   5.50315 | 3.915475 | 0.0 |  0.1188 |   19.6 |    0.0 |  0.0 |  19.7188 |  19.7188 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  19.7188 | 19.373189 | 0.0 | 0.098788 | 19.471977 | 19.690915 | 19.680915 | 0.0 |      0.0 |      0.0 | 0.0 | 26.613502 | 19.658908 | 5.466921 |
    | 04.01. 10:00 |  0.4 |  20.0 |  20.0 |  7.155036 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |  0.4752 |  7.584338 | 5.207299 | 0.0 |  0.4752 |   19.6 |    0.0 |  0.0 |  20.0752 |  20.0752 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |  20.0752 | 19.449526 | 0.0 | 0.100795 |  19.55032 | 19.557243 | 19.547243 | 0.0 |      0.0 |      0.0 | 0.0 | 26.739177 | 20.058113 |  5.42979 |
    | 04.01. 11:00 |  0.0 |  20.0 |  20.0 |  8.391432 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  8.894918 | 6.404341 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.276741 | 0.0 | 0.102791 | 19.379531 | 19.494958 | 19.484958 | 0.0 |      0.0 |      0.0 | 0.0 | 26.562436 | 20.455323 | 5.412488 |
    | 04.01. 12:00 |  0.0 |  20.0 |  20.0 |  8.391286 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  8.894763 | 6.404229 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.120091 | 0.0 | 0.104777 | 19.224868 | 19.383115 | 19.373115 | 0.0 |      0.0 |      0.0 | 0.0 | 26.542345 | 20.850546 | 5.381421 |
    | 04.01. 13:00 |  0.0 |  20.0 |  20.0 | 10.715238 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 | 11.358152 |  8.17787 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.102299 | 0.0 | 0.106753 | 19.209052 | 19.255723 | 19.245723 | 0.0 |      0.0 |      0.0 | 0.0 | 26.540046 | 21.243793 | 5.346034 |
    | 04.01. 14:00 |  0.0 |  20.0 |  20.0 |  9.383394 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  9.946398 | 7.161406 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.100263 | 0.0 | 0.108719 | 19.208982 | 19.212551 | 19.202551 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539783 | 21.635074 | 5.334042 |
    | 04.01. 15:00 |  0.0 |  20.0 |  20.0 |  7.861915 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |   8.33363 | 6.000214 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |  19.10003 | 0.0 | 0.110675 | 19.210706 | 19.209381 | 19.199381 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539753 | 22.024399 | 5.333161 |
    | 04.01. 16:00 |  0.0 |  20.0 |  20.0 |  6.298329 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  6.676229 | 4.806885 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 | 19.100003 | 0.0 | 0.112622 | 19.212625 | 19.210749 | 19.200749 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 22.411777 | 5.333541 |
    | 04.01. 17:00 |  0.0 |  20.0 |  20.0 |  2.948416 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  3.125321 | 2.250231 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 | 0.114559 | 19.214559 | 19.212629 | 19.202629 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 22.797218 | 5.334063 |
    | 04.01. 18:00 |  0.0 |  20.0 |  20.0 |  1.309232 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  1.387786 | 0.999206 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 | 0.116486 | 19.216486 | 19.214558 | 19.204558 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 23.180732 | 5.334599 |
    | 04.01. 19:00 |  0.0 |  20.0 |  20.0 |   0.32955 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.349323 | 0.251513 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 | 0.118404 | 19.218404 | 19.216484 | 19.206484 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 23.562328 | 5.335134 |
    | 04.01. 20:00 |  0.0 |  20.0 |  20.0 |  0.089508 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.094878 | 0.068313 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 | 0.120312 | 19.220312 | 19.218402 | 19.208402 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 23.942017 | 5.335667 |
    | 04.01. 21:00 |  0.0 |  20.0 |  20.0 |  0.085771 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.090917 |  0.06546 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 |  0.12221 |  19.22221 |  19.22031 |  19.21031 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 24.319807 | 5.336197 |
    | 04.01. 22:00 |  0.0 |  20.0 |  20.0 |    0.0845 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |   0.08957 |  0.06449 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 | 0.124099 | 19.224099 | 19.222208 | 19.212208 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 24.695708 | 5.336724 |
    | 04.01. 23:00 |  0.0 |  20.0 |  20.0 |  0.084864 |  20.6 |  20.6 |      1.0 | 1.1 | 0.0 |     0.0 |  0.089956 | 0.064768 | 0.0 |     0.0 |   19.6 |    0.0 |  0.0 |     19.6 |     19.6 | 0.0 |   nan | 0.0 |  0.5 |        1.0 |     19.6 |      19.1 | 0.0 | 0.125979 | 19.225979 | 19.224097 | 19.214097 | 0.0 |      0.0 |      0.0 | 0.0 | 26.539749 | 25.069729 | 5.337249 |

    .. raw:: html

        <iframe
            src="hland_v1_ex5.html"
            width="100%"
            height="930px"
            frameborder=0
        ></iframe>
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from hland
from hydpy.models.hland import hland_model
from hydpy.models.hland import hland_control
from hydpy.models.hland import hland_derived
from hydpy.models.hland import hland_inputs
from hydpy.models.hland import hland_fluxes
from hydpy.models.hland import hland_states
from hydpy.models.hland import hland_logs
from hydpy.models.hland import hland_outlets
from hydpy.models.hland.hland_parameters import Parameters
from hydpy.models.hland.hland_constants import *


class Model(modeltools.Model):
    """HBV96 version of HydPy-H-Land (hland_v1)."""
    _RUN_METHODS = (hland_model.calc_tc_v1,
                    hland_model.calc_tmean_v1,
                    hland_model.calc_fracrain_v1,
                    hland_model.calc_rfc_sfc_v1,
                    hland_model.calc_pc_v1,
                    hland_model.calc_ep_v1,
                    hland_model.calc_epc_v1,
                    hland_model.calc_tf_ic_v1,
                    hland_model.calc_ei_ic_v1,
                    hland_model.calc_sp_wc_v1,
                    hland_model.calc_melt_sp_wc_v1,
                    hland_model.calc_refr_sp_wc_v1,
                    hland_model.calc_in_wc_v1,
                    hland_model.calc_glmelt_in_v1,
                    hland_model.calc_r_sm_v1,
                    hland_model.calc_cf_sm_v1,
                    hland_model.calc_ea_sm_v1,
                    hland_model.calc_inuz_v1,
                    hland_model.calc_contriarea_v1,
                    hland_model.calc_q0_perc_uz_v1,
                    hland_model.calc_lz_v1,
                    hland_model.calc_el_lz_v1,
                    hland_model.calc_q1_lz_v1,
                    hland_model.calc_inuh_v1,
                    hland_model.calc_outuh_quh_v1,
                    hland_model.calc_qt_v1)
    _OUTLET_METHODS = (hland_model.update_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of hland_v1, directly defined by the user."""
    _PARCLASSES = (hland_control.Area,
                   hland_control.NmbZones,
                   hland_control.ZoneType,
                   hland_control.ZoneArea,
                   hland_control.ZoneZ,
                   hland_control.ZRelP,
                   hland_control.ZRelT,
                   hland_control.ZRelE,
                   hland_control.PCorr,
                   hland_control.PCAlt,
                   hland_control.RfCF,
                   hland_control.SfCF,
                   hland_control.TCAlt,
                   hland_control.ECorr,
                   hland_control.ECAlt,
                   hland_control.EPF,
                   hland_control.ETF,
                   hland_control.ERed,
                   hland_control.TTIce,
                   hland_control.IcMax,
                   hland_control.TT,
                   hland_control.TTInt,
                   hland_control.DTTM,
                   hland_control.CFMax,
                   hland_control.GMelt,
                   hland_control.CFR,
                   hland_control.WHC,
                   hland_control.FC,
                   hland_control.LP,
                   hland_control.Beta,
                   hland_control.PercMax,
                   hland_control.CFlux,
                   hland_control.RespArea,
                   hland_control.RecStep,
                   hland_control.Alpha,
                   hland_control.K,
                   hland_control.K4,
                   hland_control.Gamma,
                   hland_control.MaxBaz,
                   hland_control.Abstr)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of hland_v1, indirectly defined by the user."""
    _PARCLASSES = (hland_derived.RelZoneArea,
                   hland_derived.RelSoilArea,
                   hland_derived.RelSoilZoneArea,
                   hland_derived.RelLandZoneArea,
                   hland_derived.RelLandArea,
                   hland_derived.TTM,
                   hland_derived.DT,
                   hland_derived.NmbUH,
                   hland_derived.UH,
                   hland_derived.QFactor)


class InputSequences(sequencetools.InputSequences):
    """Input sequences of hland_v1."""
    _SEQCLASSES = (hland_inputs.P,
                   hland_inputs.T,
                   hland_inputs.TN,
                   hland_inputs.EPN)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of hland_v1."""
    _SEQCLASSES = (hland_fluxes.TMean,
                   hland_fluxes.TC,
                   hland_fluxes.FracRain,
                   hland_fluxes.RfC,
                   hland_fluxes.SfC,
                   hland_fluxes.PC,
                   hland_fluxes.EP,
                   hland_fluxes.EPC,
                   hland_fluxes.EI,
                   hland_fluxes.TF,
                   hland_fluxes.GlMelt,
                   hland_fluxes.Melt,
                   hland_fluxes.Refr,
                   hland_fluxes.In_,
                   hland_fluxes.R,
                   hland_fluxes.EA,
                   hland_fluxes.CFPot,
                   hland_fluxes.CF,
                   hland_fluxes.Perc,
                   hland_fluxes.ContriArea,
                   hland_fluxes.InUZ,
                   hland_fluxes.Q0,
                   hland_fluxes.EL,
                   hland_fluxes.Q1,
                   hland_fluxes.InUH,
                   hland_fluxes.OutUH,
                   hland_fluxes.QT)


class StateSequences(sequencetools.StateSequences):
    """State sequences of hland_v1."""
    _SEQCLASSES = (hland_states.Ic,
                   hland_states.SP,
                   hland_states.WC,
                   hland_states.SM,
                   hland_states.UZ,
                   hland_states.LZ)


class LogSequences(sequencetools.AideSequences):
    """Aide sequences of hland_v1."""
    _SEQCLASSES = (hland_logs.QUH,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of hland_v1."""
    _SEQCLASSES = (hland_outlets.Q,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import

# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from hstream
from hydpy.models.hstream import hstream_model
from hydpy.models.hstream import hstream_control
from hydpy.models.hstream import hstream_derived
from hydpy.models.hstream import hstream_states
from hydpy.models.hstream import hstream_inlets
from hydpy.models.hstream import hstream_outlets
from hydpy.models.hstream.hstream_parameters import Parameters


class Model(modeltools.Model):
    """The HBV96 version of HydPy-H-Stream (hstream_v1)."""
    _INLET_METHODS = (hstream_model.pick_q_v1,)
    _RUN_METHODS = (hstream_model.calc_qjoints_v1,)
    _OUTLET_METHODS = (hstream_model.pass_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of hstream_v1, directly defined by the user."""
    _PARCLASSES = (hstream_control.Lag,
                   hstream_control.Damp)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of hstream_v1, indirectly defined by the user."""
    _PARCLASSES = (hstream_derived.NmbSegments,
                   hstream_derived.C1,
                   hstream_derived.C2,
                   hstream_derived.C3)


class StateSequences(sequencetools.StateSequences):
    """State sequences of hstream_v1."""
    _SEQCLASSES = (hstream_states.QJoints,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of stream_v1."""
    _SEQCLASSES = (hstream_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of hstream_v1."""
    _SEQCLASSES = (hstream_outlets.Q,)


autodoc_applicationmodel()

tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""
The LARSIM-Lake version of HydPy-L-Lake (called llake_v1) is a simple lake
model. Its continuity equation is primarily solved via a central finite
difference approach.  It allows for an arbitrary number of inflows and
determines a single outflow value for each simulation time step.
The relationships between water stage, water volume and the associated
outflow are defined via vectors.  Between/beyond the triples defined by
these vectors, linear interpolation/extrapolation is performed.
The outflow vector is allowed to vary with seasonal pattern.  Therefore,
different vectors for different times of the year need to be defined.
Again, between these dates linear interpolation is performed to gain
intermediate vectors.

Two additional features are implemented.  Firstly, one can define a
maximum drop of the water stage, which is not exceeded even when the
triples of  water state, water volume and outflow indicate so.
Secondly, water can be added to or substracted from the outflow
calculated beforehand.  Both associated scalar parameters are allowed
to vary in time, as explained for the outflow vector.

Note that the accuracy of the results calculated by lake_v1 depend
on the internal step size parameter |MaxDT|.

Integration examples:

    The following calculations are performed over a period of 20 days:

    >>> from hydpy import pub, Timegrid, Timegrids, Nodes, Element
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '21.01.2000',
    ...                                    '1d'))

    Import the model and define the time settings:

    >>> from hydpy.models.llake_v1 import *
    >>> parameterstep('1d')

    For testing purposes, the model input shall be retrieved from the nodes
    `input1` and `input2` and the model output shall be passed to node
    `output`.  Firstly, define all nodes:

    >>> nodes = Nodes('input1', 'input2', 'output')

    Secondly, define the element "lake" and build the connections between
    the nodes defined above and the `llake_v1` model instance:

    >>> lake = Element('lake', inlets=['input1', 'input2'], outlets='output')
    >>> lake.connect(model)

    Prepare a test function object, which prints the respective values of
    the model sequences `qz`, `qa`, `v`, and `w`.  The node sequence `sim`
    is added in order to prove that the values calculated for `qa` are
    actually passed to `sim`:

    >>> from hydpy import IntegrationTest
    >>> test = IntegrationTest(lake,
    ...                        seqs=(fluxes.qz, fluxes.qa,
    ...                              nodes.output.sequences.sim,
    ...                              states.v, states.w),
    ...                        inits=((states.v, 0.),
    ...                               (states.w, 0.)))
    >>> test.dateformat = '%d.%m.'

    Set the values of those control parameter, which remain fixed for all
    three example simulations, in the most simple manner:

    >>> n(2)
    >>> w(0., 1.)
    >>> v(0., 1e6)
    >>> q(0., 10.)
    >>> maxdt('1d')

    Define two flood events, one for each lake inflow:

    >>> nodes.input1.sequences.sim.series = [
    ...                         0., 0., 1., 3., 2., 1., 0., 0., 0., 0.,
    ...                         0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
    >>> nodes.input2.sequences.sim.series = [
    ...                         0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...                         0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]

    In the first example, neither a restriction regarding the maximum
    water drop nor a water abstraction is defined.  Hence the sums of
    the total input (qz) and of the final output (identical with qa) are
    nearly the same.  The maximum of the final output occurs when
    the falling limb of qz intersects with qa:

    >>> maxdw(.0)
    >>> verzw(0.)
    >>> test()
    |   date |   qz |       qa |   output |             v |        w |
    ------------------------------------------------------------------
    | 01.01. |  0.0 |      0.0 |      0.0 |           0.0 |      0.0 |
    | 02.01. |  1.0 | 0.301676 | 0.301676 |  60335.195531 | 0.060335 |
    | 03.01. |  6.0 | 2.231391 | 2.231391 | 385943.010518 | 0.385943 |
    | 04.01. | 12.0 | 6.315244 | 6.315244 | 877105.886853 | 0.877106 |
    | 05.01. | 10.0 | 9.141801 | 9.141801 | 951254.290316 | 0.951254 |
    | 06.01. |  6.0 | 8.452893 | 8.452893 | 739324.327444 | 0.739324 |
    | 07.01. |  3.0 | 6.067907 | 6.067907 | 474257.135467 | 0.474257 |
    | 08.01. |  2.0 | 3.915203 | 3.915203 | 308783.556526 | 0.308784 |
    | 09.01. |  1.0 | 2.457986 | 2.457986 |  182813.58946 | 0.182814 |
    | 10.01. |  0.0 | 1.276631 | 1.276631 |  72512.652803 | 0.072513 |
    | 11.01. |  0.0 | 0.506373 | 0.506373 |   28762.00195 | 0.028762 |
    | 12.01. |  0.0 | 0.200852 | 0.200852 |  11408.391835 | 0.011408 |
    | 13.01. |  0.0 | 0.079668 | 0.079668 |   4525.116314 | 0.004525 |
    | 14.01. |  0.0 |   0.0316 |   0.0316 |   1794.878538 | 0.001795 |
    | 15.01. |  0.0 | 0.012534 | 0.012534 |    711.935063 | 0.000712 |
    | 16.01. |  0.0 | 0.004972 | 0.004972 |    282.387651 | 0.000282 |
    | 17.01. |  0.0 | 0.001972 | 0.001972 |    112.008509 | 0.000112 |
    | 18.01. |  0.0 | 0.000782 | 0.000782 |     44.427956 | 0.000044 |
    | 19.01. |  0.0 |  0.00031 |  0.00031 |     17.622262 | 0.000018 |
    | 20.01. |  0.0 | 0.000123 | 0.000123 |      6.989836 | 0.000007 |

    When the maximum water drop is set to 0.1 m/d, the resulting
    outflow hydrograph shows a plateau in its falling limb.  This
    plateau is placed in the time period, where little inflow occurs
    but the (potential) outflow is still high, due to large amounts
    of stored water.  In this time period, qa is limited by the
    maximum water drop allowed:

    >>> maxdw(.1)
    >>> verzw(0.)
    >>> test()
    |   date |   qz |       qa |   output |             v |        w |
    ------------------------------------------------------------------
    | 01.01. |  0.0 |      0.0 |      0.0 |           0.0 |      0.0 |
    | 02.01. |  1.0 | 0.301676 | 0.301676 |  60335.195531 | 0.060335 |
    | 03.01. |  6.0 | 2.231391 | 2.231391 | 385943.010518 | 0.385943 |
    | 04.01. | 12.0 | 6.315244 | 6.315244 | 877105.886853 | 0.877106 |
    | 05.01. | 10.0 | 9.141801 | 9.141801 | 951254.290316 | 0.951254 |
    | 06.01. |  6.0 | 7.157407 | 7.157407 | 851254.290316 | 0.851254 |
    | 07.01. |  3.0 | 4.157407 | 4.157407 | 751254.290316 | 0.751254 |
    | 08.01. |  2.0 | 3.157407 | 3.157407 | 651254.290316 | 0.651254 |
    | 09.01. |  1.0 | 2.157407 | 2.157407 | 551254.290316 | 0.551254 |
    | 10.01. |  0.0 | 1.157407 | 1.157407 | 451254.290316 | 0.451254 |
    | 11.01. |  0.0 | 1.157407 | 1.157407 | 351254.290316 | 0.351254 |
    | 12.01. |  0.0 | 1.157407 | 1.157407 | 251254.290316 | 0.251254 |
    | 13.01. |  0.0 | 1.157407 | 1.157407 | 151254.290316 | 0.151254 |
    | 14.01. |  0.0 | 1.056245 | 1.056245 |  59994.718505 | 0.059995 |
    | 15.01. |  0.0 | 0.418958 | 0.418958 |  23796.787787 | 0.023797 |
    | 16.01. |  0.0 | 0.166179 | 0.166179 |   9438.949346 | 0.009439 |
    | 17.01. |  0.0 | 0.065914 | 0.065914 |   3743.940802 | 0.003744 |
    | 18.01. |  0.0 | 0.026145 | 0.026145 |   1485.026799 | 0.001485 |
    | 19.01. |  0.0 |  0.01037 |  0.01037 |    589.032976 | 0.000589 |
    | 20.01. |  0.0 | 0.004113 | 0.004113 |    233.638778 | 0.000234 |

    In the above example, the water balance is still maintained.  This
    is not the case for the last example, where 1 m³/s is subtracted
    from the total outflow.  Regarding its peak time and form, the
    output hydrograph is identical/similar to the one of the first
    example:

    >>> maxdw(.0)
    >>> verzw(1.)
    >>> test()
    |   date |   qz |       qa |   output |             v |        w |
    ------------------------------------------------------------------
    | 01.01. |  0.0 |      0.0 |      0.0 |           0.0 |      0.0 |
    | 02.01. |  1.0 |      0.0 |      0.0 |  60335.195531 | 0.060335 |
    | 03.01. |  6.0 | 1.231391 | 1.231391 | 385943.010518 | 0.385943 |
    | 04.01. | 12.0 | 5.315244 | 5.315244 | 877105.886853 | 0.877106 |
    | 05.01. | 10.0 | 8.141801 | 8.141801 | 951254.290316 | 0.951254 |
    | 06.01. |  6.0 | 7.452893 | 7.452893 | 739324.327444 | 0.739324 |
    | 07.01. |  3.0 | 5.067907 | 5.067907 | 474257.135467 | 0.474257 |
    | 08.01. |  2.0 | 2.915203 | 2.915203 | 308783.556526 | 0.308784 |
    | 09.01. |  1.0 | 1.457986 | 1.457986 |  182813.58946 | 0.182814 |
    | 10.01. |  0.0 | 0.276631 | 0.276631 |  72512.652803 | 0.072513 |
    | 11.01. |  0.0 |      0.0 |      0.0 |   28762.00195 | 0.028762 |
    | 12.01. |  0.0 |      0.0 |      0.0 |  11408.391835 | 0.011408 |
    | 13.01. |  0.0 |      0.0 |      0.0 |   4525.116314 | 0.004525 |
    | 14.01. |  0.0 |      0.0 |      0.0 |   1794.878538 | 0.001795 |
    | 15.01. |  0.0 |      0.0 |      0.0 |    711.935063 | 0.000712 |
    | 16.01. |  0.0 |      0.0 |      0.0 |    282.387651 | 0.000282 |
    | 17.01. |  0.0 |      0.0 |      0.0 |    112.008509 | 0.000112 |
    | 18.01. |  0.0 |      0.0 |      0.0 |     44.427956 | 0.000044 |
    | 19.01. |  0.0 |      0.0 |      0.0 |     17.622262 | 0.000018 |
    | 20.01. |  0.0 |      0.0 |      0.0 |      6.989836 | 0.000007 |

    In the following, the given examples above repeated.  The only
    parameter that will be altered is the internal simulation step size,
    being one hour instead of one day:

    >>> maxdt('1h')
    >>> model.parameters.update()

    Hence, the principles discussed above remain valid, but the result are
    a little more accurate.

    Repetition of the first experiment:

    >>> maxdw(.0)
    >>> verzw(0.)
    >>> test()
    |   date |   qz |       qa |   output |             v |        w |
    ------------------------------------------------------------------
    | 01.01. |  0.0 |      0.0 |      0.0 |           0.0 |      0.0 |
    | 02.01. |  1.0 | 0.330363 | 0.330363 |  57856.651951 | 0.057857 |
    | 03.01. |  6.0 | 2.369607 | 2.369607 | 371522.641905 | 0.371523 |
    | 04.01. | 12.0 | 6.452208 | 6.452208 | 850851.903469 | 0.850852 |
    | 05.01. | 10.0 | 9.001249 | 9.001249 |  937143.99857 | 0.937144 |
    | 06.01. |  6.0 | 8.257642 | 8.257642 | 742083.768745 | 0.742084 |
    | 07.01. |  3.0 | 5.960357 | 5.960357 | 486308.901331 | 0.486309 |
    | 08.01. |  2.0 | 3.917231 | 3.917231 | 320660.156784 |  0.32066 |
    | 09.01. |  1.0 | 2.477622 | 2.477622 |  192993.57788 | 0.192994 |
    | 10.01. |  0.0 | 1.292357 | 1.292357 |  81333.955239 | 0.081334 |
    | 11.01. |  0.0 | 0.544642 | 0.544642 |  34276.851838 | 0.034277 |
    | 12.01. |  0.0 | 0.229531 | 0.229531 |  14445.412971 | 0.014445 |
    | 13.01. |  0.0 | 0.096732 | 0.096732 |   6087.780665 | 0.006088 |
    | 14.01. |  0.0 | 0.040766 | 0.040766 |   2565.594594 | 0.002566 |
    | 15.01. |  0.0 |  0.01718 |  0.01718 |   1081.227459 | 0.001081 |
    | 16.01. |  0.0 |  0.00724 |  0.00724 |    455.665451 | 0.000456 |
    | 17.01. |  0.0 | 0.003051 | 0.003051 |    192.032677 | 0.000192 |
    | 18.01. |  0.0 | 0.001286 | 0.001286 |     80.928999 | 0.000081 |
    | 19.01. |  0.0 | 0.000542 | 0.000542 |      34.10619 | 0.000034 |
    | 20.01. |  0.0 | 0.000228 | 0.000228 |      14.37349 | 0.000014 |

    Repetition of the second experiment:

    >>> maxdw(.1)
    >>> verzw(0.)
    >>> test()
    |   date |   qz |       qa |   output |             v |        w |
    ------------------------------------------------------------------
    | 01.01. |  0.0 |      0.0 |      0.0 |           0.0 |      0.0 |
    | 02.01. |  1.0 | 0.330363 | 0.330363 |  57856.651951 | 0.057857 |
    | 03.01. |  6.0 | 2.369607 | 2.369607 | 371522.641905 | 0.371523 |
    | 04.01. | 12.0 | 6.452208 | 6.452208 | 850851.903469 | 0.850852 |
    | 05.01. | 10.0 | 9.001249 | 9.001249 |  937143.99857 | 0.937144 |
    | 06.01. |  6.0 | 7.157407 | 7.157407 |  837143.99857 | 0.837144 |
    | 07.01. |  3.0 | 4.157407 | 4.157407 |  737143.99857 | 0.737144 |
    | 08.01. |  2.0 | 3.157407 | 3.157407 |  637143.99857 | 0.637144 |
    | 09.01. |  1.0 | 2.157407 | 2.157407 |  537143.99857 | 0.537144 |
    | 10.01. |  0.0 | 1.157407 | 1.157407 |  437143.99857 | 0.437144 |
    | 11.01. |  0.0 | 1.157407 | 1.157407 |  337143.99857 | 0.337144 |
    | 12.01. |  0.0 | 1.157407 | 1.157407 |  237143.99857 | 0.237144 |
    | 13.01. |  0.0 | 1.157407 | 1.157407 |  137143.99857 | 0.137144 |
    | 14.01. |  0.0 | 0.918367 | 0.918367 |  57797.072646 | 0.057797 |
    | 15.01. |  0.0 | 0.387031 | 0.387031 |  24357.621488 | 0.024358 |
    | 16.01. |  0.0 | 0.163108 | 0.163108 |    10265.1172 | 0.010265 |
    | 17.01. |  0.0 | 0.068739 | 0.068739 |   4326.064069 | 0.004326 |
    | 18.01. |  0.0 | 0.028969 | 0.028969 |   1823.148238 | 0.001823 |
    | 19.01. |  0.0 | 0.012208 | 0.012208 |    768.335707 | 0.000768 |
    | 20.01. |  0.0 | 0.005145 | 0.005145 |    323.802391 | 0.000324 |

    Repetition of the third experiment:

    >>> maxdw(.0)
    >>> verzw(1.)
    >>> test()
    |   date |   qz |       qa |   output |             v |        w |
    ------------------------------------------------------------------
    | 01.01. |  0.0 |      0.0 |      0.0 |           0.0 |      0.0 |
    | 02.01. |  1.0 |      0.0 |      0.0 |  57856.651951 | 0.057857 |
    | 03.01. |  6.0 | 1.369607 | 1.369607 | 371522.641905 | 0.371523 |
    | 04.01. | 12.0 | 5.452208 | 5.452208 | 850851.903469 | 0.850852 |
    | 05.01. | 10.0 | 8.001249 | 8.001249 |  937143.99857 | 0.937144 |
    | 06.01. |  6.0 | 7.257642 | 7.257642 | 742083.768745 | 0.742084 |
    | 07.01. |  3.0 | 4.960357 | 4.960357 | 486308.901331 | 0.486309 |
    | 08.01. |  2.0 | 2.917231 | 2.917231 | 320660.156784 |  0.32066 |
    | 09.01. |  1.0 | 1.477622 | 1.477622 |  192993.57788 | 0.192994 |
    | 10.01. |  0.0 | 0.292357 | 0.292357 |  81333.955239 | 0.081334 |
    | 11.01. |  0.0 |      0.0 |      0.0 |  34276.851838 | 0.034277 |
    | 12.01. |  0.0 |      0.0 |      0.0 |  14445.412971 | 0.014445 |
    | 13.01. |  0.0 |      0.0 |      0.0 |   6087.780665 | 0.006088 |
    | 14.01. |  0.0 |      0.0 |      0.0 |   2565.594594 | 0.002566 |
    | 15.01. |  0.0 |      0.0 |      0.0 |   1081.227459 | 0.001081 |
    | 16.01. |  0.0 |      0.0 |      0.0 |    455.665451 | 0.000456 |
    | 17.01. |  0.0 |      0.0 |      0.0 |    192.032677 | 0.000192 |
    | 18.01. |  0.0 |      0.0 |      0.0 |     80.928999 | 0.000081 |
    | 19.01. |  0.0 |      0.0 |      0.0 |      34.10619 | 0.000034 |
    | 20.01. |  0.0 |      0.0 |      0.0 |      14.37349 | 0.000014 |
"""
# import...
# ...from standard library
from __future__ import division, print_function
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from HydPy
from hydpy.core.modelimports import *
# ...from llake
from hydpy.models.llake import llake_model
from hydpy.models.llake import llake_control
from hydpy.models.llake import llake_derived
from hydpy.models.llake import llake_fluxes
from hydpy.models.llake import llake_states
from hydpy.models.llake import llake_aides
from hydpy.models.llake import llake_inlets
from hydpy.models.llake import llake_outlets


class Model(modeltools.Model):
    """LARSIM-Lake version of HydPy-L-Lake (llake_v1)."""
    _INLET_METHODS = (llake_model.pick_q_v1,)
    _RUN_METHODS = (llake_model.solve_dv_dt_v1,
                    llake_model.interp_w_v1,
                    llake_model.corr_dw_v1,
                    llake_model.modify_qa_v1,)
    _ADD_METHODS = (llake_model.interp_v_v1,
                    llake_model.calc_vq_v1,
                    llake_model.interp_qa_v1,
                    llake_model.calc_v_qa_v1)
    _OUTLET_METHODS = (llake_model.pass_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of llake_v1, directly defined by the user."""
    _PARCLASSES = (llake_control.N,
                   llake_control.W,
                   llake_control.V,
                   llake_control.Q,
                   llake_control.MaxDT,
                   llake_control.MaxDW,
                   llake_control.Verzw)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of llake_v1, indirectly defined by the user.
    """
    _PARCLASSES = (llake_derived.TOY,
                   llake_derived.Seconds,
                   llake_derived.NmbSubsteps,
                   llake_derived.VQ)


class StateSequences(sequencetools.StateSequences):
    """State sequences of llake_v1."""
    _SEQCLASSES = (llake_states.V,
                   llake_states.W)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of llake_v1."""
    _SEQCLASSES = (llake_fluxes.QZ,
                   llake_fluxes.QA)


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of llake_v1."""
    _SEQCLASSES = (llake_aides.QA,
                   llake_aides.VQ,
                   llake_aides.V,)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of llake_v1."""
    _SEQCLASSES = (llake_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of llake_v1."""
    _SEQCLASSES = (llake_outlets.Q,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""
Version 1 of the L-Land model is designed to agree with the LARSIM-ME
configuration of the LARSIM model used by the German Federal Institute
of Hydrology (BfG) but offers more flexibility in some regards (e.g. in
parameterization).  It can briefly be summarized as follows:

 * Simple routines for adjusting the meteorological input data.
 * Reference evapotranspiration after Turc-Wendling.
 * An enhanced degree-day method for calculating snowmelt.
 * A simple snow retention routine.
 * Landuse and month specific potential evapotranspiration.
 * Actual soil evapotranspiration after ATV-DVWK- 504 (2002).
 * A Soil routine based on the Xinanjiang model.
 * One base flow, two interflow and two direct flow components.
 * separate linear storages for modelling runoff concentration.
 * Additional evaporation from water areas.

The following figure shows the general structure of L-Land Version 1.  Note
that, besides water areas and sealed surface areas, all land use types rely
on the same set of process equations:

.. image:: HydPy-L-Land_Version-1.png

As all models implemented in HydPy, base model L-Land can principally be
applied on arbitrary simulation step sizes.  But for the L-Land version 1
application model one has to be aware, that the Turc-Wendling equation
for calculating reference evaporation is designed for daily time steps only.

Integration tests:

    All integration tests are performed over a period of five days.  Despite
    of the mentioned  limitation of the Turc-Wendling equation, an hourly
    simulation step size is selected (this results in evaporation values
    that are unrealistically high, but allows for inspecting the effect of
    evaporative soil moisture depletion within this short simulation period):

    >>> from hydpy import pub, Timegrid, Timegrids
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '05.01.2000',
    ...                                    '1h'))

    Prepare the model instance and build the connections to element `land`
    and node `outlet`:

    >>> from hydpy.models.lland_v1 import *
    >>> parameterstep('1h')
    >>> from hydpy import Node, Element
    >>> outlet = Node('outlet')
    >>> land = Element('land', outlets=outlet)
    >>> land.connect(model)

    All tests shall be performed using a single hydrological response unit
    with a size of one square kilometre at an altitude of 100 meter:

    >>> nhru(1)
    >>> ft(1.0)
    >>> fhru(1.0)
    >>> hnn(100.0)

    Initialize a test function object, which prepares and runs the tests
    and prints their results for the given sequences:

    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 800
    >>> IntegrationTest.plotting_options.activated=(
    ...     inputs.nied, inputs.teml, fluxes.q)
    >>> test = IntegrationTest(land)
    >>> test.dateformat = '%d.%m.'

    .. _lland_v1_ex1:

    **Example 1**

    In the first example, arable land is selected as the only land use
    class (for all other land types, except the ones mentioned below,
    the results would be the same):

    >>> lnk(ACKER)

    The following set of control parameter values tries to configure
    application model |lland_v1| in a manner that allows to retrace
    the influence of the different implemented methods on the shown
    results:

    >>> kg(1.2)
    >>> kt(0.8)
    >>> ke(0.4)
    >>> kf(0.6)
    >>> fln(0.5)
    >>> hinz(0.2)
    >>> lai(4.0)
    >>> treft(0.0)
    >>> trefn(0.0)
    >>> tgr(1.0)
    >>> tsp(2.0)
    >>> gtf(0.5)
    >>> rschmelz(334.0)
    >>> cpwasser(4.1868)
    >>> pwmax(1.4)
    >>> grasref_r(5.0)
    >>> nfk(200.0)
    >>> relwz(0.5)
    >>> relwb(0.05)
    >>> beta(0.005)
    >>> fbeta(1.0)
    >>> dmax(1.0)
    >>> dmin(0.1)
    >>> bsf(0.4)
    >>> a1(1.0)
    >>> a2(1.0)
    >>> tind(1.0)
    >>> eqb(100.0)
    >>> eqi1(20.0)
    >>> eqi2(10.0)
    >>> eqd1(5.0)
    >>> eqd2(2.0)
    >>> negq(False)

    Initially, relative soil moisture is 50 %, but all other "physical"
    storages are empty.  Also, only baseflow is initialized with a value
    above zero:

    >>> test.inits = ((states.inzp, 0.0),
    ...               (states.wats, 0.0),
    ...               (states.waes, 0.0),
    ...               (states.bowa, 100.0),
    ...               (states.qdgz1, 0.0),
    ...               (states.qdgz2, 0.0),
    ...               (states.qigz1, 0.0),
    ...               (states.qigz2, 0.0),
    ...               (states.qbgz, 0.5),
    ...               (states.qdga1, 0.0),
    ...               (states.qdga2, 0.0),
    ...               (states.qiga1, 0.0),
    ...               (states.qiga2, 0.0),
    ...               (states.qbga, 0.5))

    The first input data set mimics a extreme precipitation event in summer:

    >>> inputs.nied.series = (
    ...     0.0, 0.0,  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 0.2, 0.0, 0.0, 1.3, 5.6, 2.9, 4.9, 10.6, 0.1, 0.7, 3.0,
    ...     2.1, 10.4, 3.5, 3.4, 1.2, 0.1, 0.0, 0.0, 0.4, 0.1, 3.6, 5.9, 1.1,
    ...     20.7, 37.9, 8.2, 3.6, 7.5, 18.5, 15.4, 6.3, 1.9, 4.9, 2.7, 0.5,
    ...     0.2, 0.5, 2.4, 0.4, 0.2, 0.0, 0.0, 0.3, 2.6, 0.7, 0.3, 0.3, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.3, 0.0,
    ...     0.0, 0.0, 0.7, 0.4, 0.1, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    >>> inputs.teml.series = (
    ...     21.2, 19.4, 18.9, 18.3, 18.9, 22.5, 25.1, 28.3, 27.8, 31.4, 32.2,
    ...     35.2, 37.1, 31.2, 24.3, 25.4, 25.9, 23.7, 21.6, 21.2, 20.4, 19.8,
    ...     19.6, 19.2, 19.2, 19.2, 18.9, 18.7, 18.5, 18.3, 18.5, 18.8, 18.8,
    ...     19.0, 19.2, 19.3, 19.0, 18.8, 18.7, 17.8, 17.4, 17.3, 16.8, 16.5,
    ...     16.3, 16.2, 15.5, 14.6, 14.7, 14.6, 14.1, 14.3, 14.9, 15.7, 16.0,
    ...     16.7, 17.1, 16.2, 15.9, 16.3, 16.3, 16.4, 16.5, 18.4, 18.3, 18.1,
    ...     16.7, 15.2, 13.4, 12.4, 11.6, 11.0, 10.5, 11.7, 11.9, 11.2, 11.1,
    ...     11.9, 12.2, 11.8, 11.4, 11.6, 13.0, 17.1, 18.2, 22.4, 21.4, 21.8,
    ...     22.2, 20.1, 17.8, 15.2, 14.5, 12.4, 11.7, 11.9)
    >>> inputs.glob.series = (
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 11.2, 105.5, 248.3, 401.3, 449.7,
    ...     493.4, 261.5, 363.6, 446.2, 137.6, 103.0, 63.7, 41.4, 7.9, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.1, 77.9, 196.7,
    ...     121.9, 156.6, 404.7, 217.9, 582.0, 263.9, 136.8, 146.6, 190.6,
    ...     103.5, 13.8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     4.4, 26.1, 74.2, 287.1, 299.8, 363.5, 368.4, 317.8, 534.7, 319.4,
    ...     350.6, 215.4, 97.8, 13.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 17.0, 99.7, 239.4, 391.2, 525.6, 570.2, 559.1, 668.0,
    ...     593.4, 493.0, 391.2, 186.0, 82.4, 17.0, 0.0, 0.0, 0.0, 0.0)

    The following results show that all relevant model components, except
    the snow routines, are activated at least once within the simulation
    period.  Take your time to click and scroll through the figure, to see
    e.g. how the soil moisture content |BoWa| is varying over time.  One
    might realize the "linear storage" type of relationship between inflow
    |Nied| and outflow |lland_fluxes.Q|.  This is due to the dominance
    of the direct runoff generation (|QDGZ|) based on the Xinanjiang model
    and runoff concentration being modelled by linear storages only
    (easy inspectable through clicking e.g. on |QDGZ1| and |QDGA1|):

    >>> test('lland_v1_ex1')
    |   date | nied | teml |  glob |  nkor | tkor |      et0 |     evpo |      nbes | sbes |      evi |      evb |      wgtf | schm |      wada |       qdb |     qib1 |     qib2 |      qbb |      qdgz |        q |     inzp | wats | waes |       bowa |    qdgz1 |     qdgz2 |    qigz1 |    qigz2 |     qbgz |    qdga1 |    qdga2 |    qiga1 |    qiga2 |     qbga |   outlet |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |   0.0 |   0.0 | 22.0 | 0.040283 | 0.020141 |       0.0 |  0.0 |      0.0 | 0.017301 | 11.275777 |  0.0 |       0.0 |       0.0 |     0.05 |      0.0 |     0.45 |       0.0 |  0.50098 |      0.0 |  0.0 |  0.0 |  99.482699 |      0.0 |       0.0 |     0.05 |      0.0 |     0.45 |      0.0 |      0.0 | 0.001229 |      0.0 | 0.499751 | 0.139161 |
    | 01.01. |  0.0 | 19.4 |   0.0 |   0.0 | 20.2 | 0.039121 |  0.01956 |       0.0 |  0.0 |      0.0 | 0.016766 | 10.353214 |  0.0 |       0.0 |       0.0 | 0.049741 |      0.0 | 0.447413 |       0.0 | 0.502845 |      0.0 |  0.0 |  0.0 |  98.968778 |      0.0 |       0.0 | 0.049741 |      0.0 | 0.447413 |      0.0 |      0.0 | 0.003602 |      0.0 | 0.499243 | 0.139679 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.016589 | 10.096946 |  0.0 |       0.0 |       0.0 | 0.049484 |      0.0 | 0.444844 |       0.0 |  0.50456 |      0.0 |  0.0 |  0.0 |  98.457861 |      0.0 |       0.0 | 0.049484 |      0.0 | 0.444844 |      0.0 |      0.0 | 0.005846 |      0.0 | 0.498714 | 0.140156 |
    | 01.01. |  0.0 | 18.3 |   0.0 |   0.0 | 19.1 | 0.038396 | 0.019198 |       0.0 |  0.0 |      0.0 | 0.016383 |  9.789425 |  0.0 |       0.0 |       0.0 | 0.049229 |      0.0 | 0.442289 |       0.0 | 0.506133 |      0.0 |  0.0 |  0.0 |   97.94996 |      0.0 |       0.0 | 0.049229 |      0.0 | 0.442289 |      0.0 |      0.0 | 0.007968 |      0.0 | 0.498166 | 0.140593 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.016516 | 10.096946 |  0.0 |       0.0 |       0.0 | 0.048975 |      0.0 |  0.43975 |       0.0 | 0.507571 |      0.0 |  0.0 |  0.0 |  97.444719 |      0.0 |       0.0 | 0.048975 |      0.0 |  0.43975 |      0.0 |      0.0 | 0.009974 |      0.0 | 0.497597 | 0.140992 |
    | 01.01. |  0.0 | 22.5 |   0.0 |   0.0 | 23.3 | 0.041105 | 0.020552 |       0.0 |  0.0 |      0.0 | 0.017461 | 11.942073 |  0.0 |       0.0 |       0.0 | 0.048722 |      0.0 | 0.437224 |       0.0 | 0.508878 |      0.0 |  0.0 |  0.0 |  96.941312 |      0.0 |       0.0 | 0.048722 |      0.0 | 0.437224 |      0.0 |      0.0 |  0.01187 |      0.0 | 0.497009 | 0.141355 |
    | 01.01. |  0.0 | 25.1 |  11.2 |   0.0 | 25.9 | 0.116763 | 0.058382 |       0.0 |  0.0 |      0.0 |  0.04949 | 13.274665 |  0.0 |       0.0 |       0.0 | 0.048471 |      0.0 | 0.434707 |       0.0 | 0.510062 |      0.0 |  0.0 |  0.0 |  96.408644 |      0.0 |       0.0 | 0.048471 |      0.0 | 0.434707 |      0.0 |      0.0 | 0.013661 |      0.0 | 0.496401 | 0.141684 |
    | 01.01. |  0.0 | 28.3 | 105.5 |   0.0 | 29.1 |  0.77315 | 0.386575 |       0.0 |  0.0 |      0.0 | 0.326912 | 14.914778 |  0.0 |       0.0 |       0.0 | 0.048204 |      0.0 | 0.432043 |       0.0 | 0.511126 |      0.0 |  0.0 |  0.0 |  95.601485 |      0.0 |       0.0 | 0.048204 |      0.0 | 0.432043 |      0.0 |      0.0 | 0.015352 |      0.0 | 0.495774 | 0.141979 |
    | 01.01. |  0.0 | 27.8 | 248.3 |   0.0 | 28.6 | 1.747814 | 0.873907 |       0.0 |  0.0 |      0.0 | 0.736293 |  14.65851 |  0.0 |       0.0 |       0.0 | 0.047801 |      0.0 | 0.428007 |       0.0 | 0.512064 |      0.0 |  0.0 |  0.0 |  94.389384 |      0.0 |       0.0 | 0.047801 |      0.0 | 0.428007 |      0.0 |      0.0 | 0.016944 |      0.0 |  0.49512 |  0.14224 |
    | 01.01. |  0.0 | 31.4 | 401.3 |   0.0 | 32.2 | 2.927022 | 1.463511 |       0.0 |  0.0 |      0.0 | 1.226019 | 16.503638 |  0.0 |       0.0 |       0.0 | 0.047195 |      0.0 | 0.421947 |       0.0 | 0.512856 |      0.0 |  0.0 |  0.0 |  92.694223 |      0.0 |       0.0 | 0.047195 |      0.0 | 0.421947 |      0.0 |      0.0 | 0.018434 |      0.0 | 0.494422 |  0.14246 |
    | 01.01. |  0.0 | 32.2 | 449.7 |   0.0 | 33.0 | 3.305745 | 1.652872 |       0.0 |  0.0 |      0.0 | 1.373206 | 16.913666 |  0.0 |       0.0 |       0.0 | 0.046347 |      0.0 | 0.413471 |       0.0 | 0.513475 |      0.0 |  0.0 |  0.0 |  90.861198 |      0.0 |       0.0 | 0.046347 |      0.0 | 0.413471 |      0.0 |      0.0 | 0.019816 |      0.0 | 0.493659 | 0.142632 |
    | 01.01. |  0.0 | 35.2 | 493.4 |   0.0 | 36.0 | 3.747947 | 1.873973 |       0.0 |  0.0 |      0.0 |  1.54235 | 18.451272 |  0.0 |       0.0 |       0.0 | 0.045431 |      0.0 | 0.404306 |       0.0 | 0.513903 |      0.0 |  0.0 |  0.0 |  88.869112 |      0.0 |       0.0 | 0.045431 |      0.0 | 0.404306 |      0.0 |      0.0 | 0.021087 |      0.0 | 0.492815 | 0.142751 |
    | 01.01. |  0.0 | 37.1 | 261.5 |   0.0 | 37.9 | 2.050471 | 1.025236 |       0.0 |  0.0 |      0.0 | 0.834816 | 19.425089 |  0.0 |       0.0 |       0.0 | 0.044435 |      0.0 | 0.394346 |       0.0 | 0.514135 |      0.0 |  0.0 |  0.0 |  87.595516 |      0.0 |       0.0 | 0.044435 |      0.0 | 0.394346 |      0.0 |      0.0 |  0.02225 |      0.0 | 0.491885 | 0.142815 |
    | 01.01. |  0.0 | 31.2 | 363.6 |   0.0 | 32.0 | 2.650012 | 1.325006 |       0.0 |  0.0 |      0.0 | 1.071233 | 16.401131 |  0.0 |       0.0 |       0.0 | 0.043798 |      0.0 | 0.387978 |       0.0 | 0.514199 |      0.0 |  0.0 |  0.0 |  86.092508 |      0.0 |       0.0 | 0.043798 |      0.0 | 0.387978 |      0.0 |      0.0 | 0.023316 |      0.0 | 0.490883 | 0.142833 |
    | 01.01. |  0.0 | 24.3 | 446.2 |   0.0 | 25.1 | 2.959048 | 1.479524 |       0.0 |  0.0 |      0.0 | 1.185757 | 12.864637 |  0.0 |       0.0 |       0.0 | 0.043046 |      0.0 | 0.380463 |       0.0 | 0.514118 |      0.0 |  0.0 |  0.0 |  84.483242 |      0.0 |       0.0 | 0.043046 |      0.0 | 0.380463 |      0.0 |      0.0 | 0.024297 |      0.0 | 0.489821 | 0.142811 |
    | 01.01. |  0.2 | 25.4 | 137.6 |  0.24 | 26.2 | 0.956604 | 0.478302 |       0.0 |  0.0 |     0.24 | 0.189137 | 13.428426 |  0.0 |       0.0 |       0.0 | 0.042242 |      0.0 | 0.372416 |       0.0 | 0.513884 |      0.0 |  0.0 |  0.0 |  83.879447 |      0.0 |       0.0 | 0.042242 |      0.0 | 0.372416 |      0.0 |      0.0 | 0.025191 |      0.0 | 0.488693 | 0.142746 |
    | 01.01. |  0.0 | 25.9 | 103.0 |   0.0 | 26.7 | 0.731933 | 0.365967 |       0.0 |  0.0 |      0.0 | 0.289373 | 13.684693 |  0.0 |       0.0 |       0.0 |  0.04194 |      0.0 | 0.369397 |       0.0 | 0.513537 |      0.0 |  0.0 |  0.0 |  83.178737 |      0.0 |       0.0 |  0.04194 |      0.0 | 0.369397 |      0.0 |      0.0 | 0.026016 |      0.0 | 0.487521 | 0.142649 |
    | 01.01. |  0.0 | 23.7 |  63.7 |   0.0 | 24.5 | 0.454628 | 0.227314 |       0.0 |  0.0 |      0.0 | 0.178944 | 12.557116 |  0.0 |       0.0 |       0.0 | 0.041589 |      0.0 | 0.365894 |       0.0 | 0.513112 |      0.0 |  0.0 |  0.0 |   82.59231 |      0.0 |       0.0 | 0.041589 |      0.0 | 0.365894 |      0.0 |      0.0 | 0.026784 |      0.0 | 0.486328 | 0.142531 |
    | 01.01. |  1.3 | 21.6 |  41.4 |  1.56 | 22.4 | 0.300394 | 0.150197 |      0.76 |  0.0 | 0.150197 |      0.0 | 11.480791 |  0.0 |      0.76 |  0.107812 | 0.041296 |      0.0 | 0.362962 |  0.107812 | 0.522711 | 0.649803 |  0.0 |  0.0 |   82.84024 | 0.107812 |       0.0 | 0.041296 |      0.0 | 0.362962 | 0.010097 |      0.0 | 0.027498 |      0.0 | 0.485115 | 0.145197 |
    | 01.01. |  5.6 | 21.2 |   7.9 |  6.72 | 22.0 | 0.089558 | 0.044779 |  6.569803 |  0.0 | 0.044779 |      0.0 | 11.275777 |  0.0 |  6.569803 |   0.96994 |  0.04142 |      0.0 | 0.364201 |   0.96994 | 0.620632 | 0.755221 |  0.0 |  0.0 |  88.034482 |  0.96994 |       0.0 |  0.04142 |      0.0 | 0.364201 | 0.108551 |      0.0 | 0.028174 |      0.0 | 0.483906 | 0.172398 |
    | 01.01. |  2.9 | 20.4 |   0.0 |  3.48 | 21.2 |  0.03977 | 0.019885 |  3.435221 |  0.0 | 0.019885 |      0.0 | 10.865749 |  0.0 |  3.435221 |  0.535552 | 0.044017 |      0.0 | 0.390172 |  0.535552 | 0.735741 | 0.780115 |  0.0 |  0.0 |  90.499961 | 0.535552 |       0.0 | 0.044017 |      0.0 | 0.390172 | 0.224012 |      0.0 | 0.028884 |      0.0 | 0.482844 | 0.204372 |
    | 01.01. |  4.9 | 19.8 |   0.0 |  5.88 | 20.6 | 0.039381 | 0.019691 |  5.860115 |  0.0 | 0.019691 |      0.0 | 10.558228 |  0.0 |  5.860115 |  0.958535 |  0.04525 |      0.0 |   0.4025 |  0.958535 | 0.831735 | 0.780309 |  0.0 |  0.0 |  94.953791 | 0.958535 |       0.0 |  0.04525 |      0.0 |   0.4025 | 0.320099 |      0.0 | 0.029653 |      0.0 | 0.481984 | 0.231038 |
    | 01.01. | 10.6 | 19.6 |   0.0 | 12.72 | 20.4 | 0.039251 | 0.019626 | 12.700309 |  0.0 | 0.019626 |      0.0 | 10.455721 |  0.0 | 12.700309 |  2.288291 | 0.047477 |      0.0 | 0.424769 |  2.288291 | 1.158742 | 0.780374 |  0.0 |  0.0 | 104.893563 | 1.562993 |  0.725298 | 0.047477 |      0.0 | 0.424769 | 0.492438 | 0.154533 | 0.030468 |      0.0 | 0.481304 | 0.321873 |
    | 01.01. |  0.1 | 19.2 |   0.0 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.100374 |  0.0 | 0.019495 |      0.0 | 10.250707 |  0.0 |  0.100374 |  0.019216 | 0.052447 | 0.009743 | 0.474468 |  0.019216 | 1.279374 | 0.780505 |  0.0 |  0.0 | 104.438065 | 0.019216 |       0.0 | 0.052447 | 0.009743 | 0.474468 | 0.541916 | 0.224579 |  0.03142 | 0.000471 | 0.480989 | 0.355382 |
    | 02.01. |  0.7 | 19.2 |   0.0 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.820505 |  0.0 | 0.019495 |      0.0 | 10.250707 |  0.0 |  0.820505 |   0.15675 | 0.052219 | 0.008415 |  0.47219 |   0.15675 | 1.110902 | 0.780505 |  0.0 |  0.0 | 104.568996 |  0.15675 |       0.0 | 0.052219 | 0.008415 |  0.47219 | 0.460047 | 0.136214 |  0.03244 | 0.001289 | 0.480913 | 0.308584 |
    | 02.01. |  3.0 | 19.2 |   0.0 |   3.6 | 20.0 |  0.03899 | 0.019495 |  3.580505 |  0.0 | 0.019495 |      0.0 | 10.250707 |  0.0 |  3.580505 |  0.694905 | 0.052284 |  0.00879 | 0.472845 |  0.694905 | 1.054307 | 0.780505 |  0.0 |  0.0 | 106.920677 | 0.694905 |       0.0 | 0.052284 |  0.00879 | 0.472845 | 0.455469 | 0.082618 | 0.033406 | 0.001986 | 0.480829 | 0.292863 |
    | 02.01. |  2.1 | 18.9 |   0.0 |  2.52 | 19.7 | 0.038793 | 0.019396 |  2.500505 |  0.0 | 0.019396 |      0.0 | 10.096946 |  0.0 |  2.500505 |  0.497074 |  0.05346 | 0.016386 | 0.484603 |  0.497074 | 1.048618 | 0.780604 |  0.0 |  0.0 | 108.369658 | 0.497074 |       0.0 |  0.05346 | 0.016386 | 0.484603 | 0.480344 |  0.05011 | 0.034356 |    0.003 | 0.480808 | 0.291283 |
    | 02.01. | 10.4 | 18.7 |   0.0 | 12.48 | 19.5 | 0.038661 |  0.01933 | 12.460604 |  0.0 |  0.01933 |      0.0 |  9.994439 |  0.0 | 12.460604 |  2.648297 | 0.054185 | 0.021792 | 0.491848 |  2.648297 | 1.358463 |  0.78067 |  0.0 |  0.0 | 117.614139 | 1.622399 |  1.025898 | 0.054185 | 0.021792 | 0.491848 | 0.588767 | 0.248973 | 0.035305 | 0.004536 | 0.480882 | 0.377351 |
    | 02.01. |  3.5 | 18.5 |   0.0 |   4.2 | 19.3 | 0.038528 | 0.019264 |   4.18067 |  0.0 | 0.019264 |      0.0 |  9.891932 |  0.0 |   4.18067 |  0.954177 | 0.058807 | 0.066533 | 0.538071 |  0.954177 | 1.575545 | 0.780736 |  0.0 |  0.0 | 120.177222 | 0.954177 |       0.0 | 0.058807 | 0.066533 | 0.538071 | 0.713551 |  0.33609 |  0.03634 | 0.008342 | 0.481222 | 0.437651 |
    | 02.01. |  3.4 | 18.3 |   0.0 |  4.08 | 19.1 | 0.038396 | 0.019198 |  4.060736 |  0.0 | 0.019198 |      0.0 |  9.789425 |  0.0 |  4.060736 |   0.95486 | 0.060089 | 0.081571 | 0.550886 |   0.95486 | 1.495007 | 0.780802 |  0.0 |  0.0 | 122.590552 |  0.95486 |       0.0 | 0.060089 | 0.081571 | 0.550886 | 0.757233 | 0.203849 | 0.037467 | 0.014607 | 0.481851 |  0.41528 |
    | 02.01. |  1.2 | 18.5 |   6.1 |  1.44 | 19.3 | 0.074919 |  0.03746 |  1.420802 |  0.0 |  0.03746 |      0.0 |  9.891932 |  0.0 |  1.420802 |  0.339664 | 0.061295 | 0.096635 | 0.562953 |  0.339664 | 1.401988 |  0.76254 |  0.0 |  0.0 | 122.950807 | 0.339664 |       0.0 | 0.061295 | 0.096635 | 0.562953 | 0.735442 | 0.123641 |   0.0386 | 0.021708 | 0.482598 | 0.389441 |
    | 02.01. |  0.1 | 18.8 |  77.9 |  0.12 | 19.6 | 0.505845 | 0.252922 |   0.08254 |  0.0 | 0.252922 |      0.0 | 10.045692 |  0.0 |   0.08254 |  0.019698 | 0.061475 | 0.098955 | 0.564754 |  0.019698 | 1.260794 | 0.547078 |  0.0 |  0.0 | 122.288465 | 0.019698 |       0.0 | 0.061475 | 0.098955 | 0.564754 | 0.633733 | 0.074992 | 0.039711 | 0.028951 | 0.483407 |  0.35022 |
    | 02.01. |  0.0 | 18.8 | 196.7 |   0.0 | 19.6 | 1.218215 | 0.609108 |       0.0 |  0.0 | 0.547078 | 0.057195 | 10.045692 |  0.0 |       0.0 |       0.0 | 0.061144 | 0.094703 | 0.561442 |       0.0 | 1.126438 |      0.0 |  0.0 |  0.0 | 121.513981 |      0.0 |       0.0 | 0.061144 | 0.094703 | 0.561442 | 0.520583 | 0.045485 | 0.040764 | 0.035407 |   0.4842 |   0.3129 |
    | 02.01. |  0.0 | 19.0 | 121.9 |   0.0 | 19.8 | 0.772303 | 0.386152 |       0.0 |  0.0 |      0.0 | 0.355393 |   10.1482 |  0.0 |       0.0 |       0.0 | 0.060757 |  0.08981 |  0.55757 |       0.0 | 1.021316 |      0.0 |  0.0 |  0.0 | 120.450452 |      0.0 |       0.0 | 0.060757 |  0.08981 |  0.55757 | 0.426217 | 0.027588 | 0.041749 | 0.040813 | 0.484949 | 0.283699 |
    | 02.01. |  0.4 | 19.2 | 156.6 |  0.48 | 20.0 | 0.984401 |   0.4922 |       0.0 |  0.0 |     0.48 | 0.011199 | 10.250707 |  0.0 |       0.0 |       0.0 | 0.060225 | 0.083233 | 0.552252 |       0.0 | 0.939155 |      0.0 |  0.0 |  0.0 | 119.743542 |      0.0 |       0.0 | 0.060225 | 0.083233 | 0.552252 | 0.348957 | 0.016733 | 0.042663 | 0.045158 | 0.485645 | 0.260876 |
    | 02.01. |  0.1 | 19.3 | 404.7 |  0.12 | 20.1 | 2.486378 | 1.243189 |       0.0 |  0.0 |     0.12 | 1.029208 |  10.30196 |  0.0 |       0.0 |       0.0 | 0.059872 | 0.078955 | 0.548718 |       0.0 | 0.874225 |      0.0 |  0.0 |  0.0 | 118.026789 |      0.0 |       0.0 | 0.059872 | 0.078955 | 0.548718 | 0.285702 | 0.010149 | 0.043511 | 0.048574 |  0.48629 |  0.24284 |
    | 02.01. |  3.6 | 19.0 | 217.9 |  4.32 | 19.8 | 1.349913 | 0.674957 |      3.52 |  0.0 | 0.674957 |      0.0 |   10.1482 |  0.0 |      3.52 |  0.804879 | 0.059013 | 0.068884 | 0.540134 |  0.804879 | 0.897582 | 0.125043 |  0.0 |  0.0 | 120.073879 | 0.804879 |       0.0 | 0.059013 | 0.068884 | 0.540134 | 0.309293 | 0.006156 | 0.044287 | 0.050978 | 0.486868 | 0.249328 |
    | 02.01. |  5.9 | 18.8 | 582.0 |  7.08 | 19.6 | 3.528622 | 1.764311 |  6.405043 |  0.0 |      0.8 | 0.884358 | 10.045692 |  0.0 |  6.405043 |  1.520398 | 0.060037 | 0.080945 | 0.550369 |  1.520398 | 1.076887 |      0.0 |  0.0 |  0.0 | 123.382815 | 1.342277 |   0.17812 | 0.060037 | 0.080945 | 0.550369 | 0.449457 | 0.041684 | 0.045031 | 0.053265 | 0.487449 | 0.299135 |
    | 02.01. |  1.1 | 18.7 | 263.9 |  1.32 | 19.5 |  1.61841 | 0.809205 |      0.52 |  0.0 |      0.8 | 0.008509 |  9.994439 |  0.0 |      0.52 |  0.124975 | 0.061691 | 0.101762 | 0.566914 |  0.124975 | 1.145578 |      0.0 |  0.0 |  0.0 | 123.038962 | 0.124975 |       0.0 | 0.061691 | 0.101762 | 0.566914 | 0.497293 | 0.057417 | 0.045803 | 0.056906 | 0.488158 | 0.318216 |
    | 02.01. | 20.7 | 17.8 | 136.8 | 24.84 | 18.6 | 0.844303 | 0.422151 |     24.04 |  0.0 | 0.422151 |      0.0 |  9.533157 |  0.0 |     24.04 |  6.385076 | 0.061519 | 0.099526 | 0.565195 |  6.385076 | 2.189796 | 0.377849 |  0.0 |  0.0 | 139.967646 | 1.843385 |  4.541691 | 0.061519 | 0.099526 | 0.565195 | 0.590738 | 1.002484 | 0.046574 | 0.061067 | 0.488933 | 0.608277 |
    | 02.01. | 37.9 | 17.4 | 146.6 | 45.48 | 18.2 | 0.895703 | 0.447851 | 45.057849 |  0.0 | 0.447851 |      0.0 |  9.328143 |  0.0 | 45.057849 | 15.758715 | 0.069984 | 0.227408 | 0.649838 | 15.758715 | 5.807432 | 0.352149 |  0.0 |  0.0 |  168.31955 | 1.936543 | 13.822172 | 0.069984 | 0.227408 | 0.649838 | 0.826529 | 4.372365 | 0.047511 | 0.070913 | 0.490114 | 1.613176 |
    | 02.01. |  8.2 | 17.3 | 190.6 |  9.84 | 18.1 | 1.151139 |  0.57557 |  9.392149 |  0.0 |  0.57557 |      0.0 |  9.276889 |  0.0 |  9.392149 |   3.98674 |  0.08416 |  0.50823 | 0.791598 |   3.98674 | 7.273291 |  0.22443 |  0.0 |  0.0 | 172.340972 | 1.749168 |  2.237571 |  0.08416 |  0.50823 | 0.791598 | 1.010192 | 5.622344 | 0.048956 |  0.09939 | 0.492409 | 2.020359 |
    | 02.01. |  3.6 | 16.8 | 103.5 |  4.32 | 17.6 | 0.636581 |  0.31829 |   3.74443 |  0.0 |  0.31829 |      0.0 |  9.020622 |  0.0 |   3.74443 |  1.640416 |  0.08617 | 0.553757 | 0.811705 |  1.640416 | 5.664322 |  0.48171 |  0.0 |  0.0 | 172.993354 | 1.390398 |  0.250017 |  0.08617 | 0.553757 | 0.811705 | 1.110546 | 3.867069 | 0.050722 | 0.140498 | 0.495487 | 1.573423 |
    | 02.01. |  7.5 | 16.5 |  13.8 |   9.0 | 17.3 | 0.116642 | 0.058321 |   8.68171 |  0.0 | 0.058321 |      0.0 |  8.866861 |  0.0 |   8.68171 |  3.912578 | 0.086497 | 0.561264 | 0.814967 |  3.912578 | 4.778279 | 0.741679 |  0.0 |  0.0 | 176.299758 | 1.744414 |  2.168164 | 0.086497 | 0.561264 | 0.814967 | 1.194429 | 2.852553 | 0.052459 | 0.180188 | 0.498649 |   1.3273 |
    | 02.01. | 18.5 | 16.3 |   0.0 |  22.2 | 17.1 | 0.037049 | 0.018524 | 22.141679 |  0.0 | 0.018524 |      0.0 |  8.764354 |  0.0 | 22.141679 | 11.051853 |  0.08815 | 0.599829 | 0.831499 | 11.051853 | 6.153137 | 0.781476 |  0.0 |  0.0 | 185.870106 | 1.909517 |  9.142336 |  0.08815 | 0.599829 | 0.831499 | 1.309587 | 4.069193 |  0.05416 | 0.218318 | 0.501879 | 1.709205 |
    | 02.01. | 15.4 | 16.2 |   0.0 | 18.48 | 17.0 |  0.03698 |  0.01849 | 18.461476 |  0.0 |  0.01849 |      0.0 |  8.713101 |  0.0 | 18.461476 | 10.642573 | 0.092935 | 0.716152 | 0.879351 | 10.642573 | 8.218452 |  0.78151 |  0.0 |  0.0 |  192.00057 | 1.906038 |  8.736535 | 0.092935 | 0.716152 | 0.879351 |  1.41801 | 5.978859 | 0.055935 | 0.260251 | 0.505397 | 2.282903 |
    | 02.01. |  6.3 | 15.5 |   0.0 |  7.56 | 16.3 | 0.036499 |  0.01825 |   7.54151 |  0.0 |  0.01825 |      0.0 |  8.354326 |  0.0 |   7.54151 |  4.706327 |    0.096 | 0.794197 | 0.910003 |  4.706327 | 8.194259 |  0.78175 |  0.0 |  0.0 | 193.035552 |  1.78752 |  2.918807 |    0.096 | 0.794197 | 0.910003 | 1.495375 | 5.824387 | 0.057815 | 0.307411 | 0.509271 | 2.276183 |
    | 02.01. |  1.9 | 14.6 |   0.0 |  2.28 | 15.4 | 0.035873 | 0.017937 |   2.26175 |  0.0 | 0.017937 |      0.0 |  7.893044 |  0.0 |   2.26175 |  1.410813 | 0.096518 | 0.807636 | 0.915178 |  1.410813 |  6.51394 | 0.782063 |  0.0 |  0.0 | 192.067158 | 1.291189 |  0.119624 | 0.096518 | 0.807636 | 0.915178 | 1.501849 | 4.084733 |  0.05969 | 0.354385 | 0.513284 | 1.809428 |
    | 03.01. |  4.9 | 14.7 |   0.0 |  5.88 | 15.5 | 0.035943 | 0.017972 |  5.862063 |  0.0 | 0.017972 |      0.0 |  7.944298 |  0.0 |  5.862063 |   3.63316 | 0.096034 | 0.795059 | 0.910336 |   3.63316 | 5.385613 | 0.782028 |  0.0 |  0.0 | 192.494632 | 1.724758 |  1.908403 | 0.096034 | 0.795059 | 0.910336 | 1.504268 | 2.905704 | 0.061474 | 0.396909 | 0.517259 | 1.496004 |
    | 03.01. |  2.7 | 14.6 |   0.0 |  3.24 | 15.4 | 0.035873 | 0.017937 |  3.222028 |  0.0 | 0.017937 |      0.0 |  7.893044 |  0.0 |  3.222028 |  1.991828 | 0.096247 | 0.800603 | 0.912473 |  1.991828 | 4.754322 | 0.782063 |  0.0 |  0.0 | 191.915509 | 1.497949 |   0.49388 | 0.096247 | 0.800603 | 0.912473 | 1.522994 | 2.211916 | 0.063165 | 0.435066 | 0.521181 | 1.320645 |
    | 03.01. |  0.5 | 14.1 |   0.0 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.582063 |  0.0 | 0.017761 |      0.0 |  7.636776 |  0.0 |  0.582063 |  0.350289 | 0.095958 | 0.793096 | 0.909578 |  0.350289 | 3.900986 | 0.782239 |  0.0 |  0.0 | 190.348652 | 0.350289 |       0.0 | 0.095958 | 0.793096 | 0.909578 | 1.410972 | 1.430695 | 0.064771 | 0.469488 |  0.52506 | 1.083607 |
    | 03.01. |  0.2 | 14.3 |   0.0 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.222239 |  0.0 | 0.017831 |      0.0 |  7.739283 |  0.0 |  0.222239 |  0.128894 | 0.095174 | 0.772903 | 0.901743 |  0.128894 | 3.160155 | 0.782169 |  0.0 |  0.0 | 188.672176 | 0.128894 |       0.0 | 0.095174 | 0.772903 | 0.901743 | 1.197968 |  0.86776 | 0.066273 | 0.499307 | 0.528847 | 0.877821 |
    | 03.01. |  0.5 | 14.9 |   0.0 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.582169 |  0.0 | 0.018041 |      0.0 |  8.046805 |  0.0 |  0.582169 |  0.326672 | 0.094336 | 0.751491 | 0.893361 |  0.326672 | 2.673508 | 0.781959 |  0.0 |  0.0 | 187.188486 | 0.326672 |       0.0 | 0.094336 | 0.751491 | 0.893361 |   1.0227 | 0.526323 | 0.067662 | 0.524307 | 0.532515 | 0.742641 |
    | 03.01. |  2.4 | 15.7 |   0.0 |  2.88 | 16.5 | 0.036637 | 0.018319 |  2.861959 |  0.0 | 0.018319 |      0.0 |  8.456833 |  0.0 |  2.861959 |   1.57602 | 0.093594 | 0.732708 | 0.885942 |   1.57602 | 2.507939 | 0.781681 |  0.0 |  0.0 | 186.762179 |  1.36549 |   0.21053 | 0.093594 | 0.732708 | 0.885942 | 0.993821 | 0.364087 | 0.068944 | 0.545018 | 0.536069 |  0.69665 |
    | 03.01. |  0.4 | 16.0 |   4.4 |  0.48 | 16.8 | 0.061945 | 0.030972 |  0.461681 |  0.0 | 0.030972 |      0.0 |  8.610594 |  0.0 |  0.461681 |  0.249638 | 0.093381 | 0.727341 | 0.883811 |  0.249638 | 2.387801 | 0.769028 |  0.0 |  0.0 | 185.269689 | 0.249638 |       0.0 | 0.093381 | 0.727341 | 0.883811 |  0.95669 | 0.258811 | 0.070141 |  0.56262 | 0.539539 | 0.663278 |
    | 03.01. |  0.2 | 16.7 |  26.1 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.209028 |  0.0 | 0.094074 |      0.0 |  8.969368 |  0.0 |  0.209028 |  0.109916 | 0.092635 | 0.708654 | 0.876348 |  0.109916 | 2.163989 | 0.705926 |  0.0 |  0.0 | 183.691162 | 0.109916 |       0.0 | 0.092635 | 0.708654 | 0.876348 | 0.815437 | 0.156977 | 0.071256 | 0.577391 | 0.542928 | 0.601108 |
    | 03.01. |  0.0 | 17.1 |  74.2 |   0.0 | 17.9 |  0.46949 | 0.234745 |       0.0 |  0.0 | 0.234745 |      0.0 |  9.174382 |  0.0 |       0.0 |       0.0 | 0.091846 | 0.689068 | 0.868456 |       0.0 | 1.979886 | 0.471181 |  0.0 |  0.0 | 182.041793 |      0.0 |       0.0 | 0.091846 | 0.689068 | 0.868456 | 0.677254 | 0.095211 |  0.07228 | 0.588935 | 0.546206 | 0.549968 |
    | 03.01. |  0.0 | 16.2 | 287.1 |   0.0 | 17.0 | 1.680918 | 0.840459 |       0.0 |  0.0 | 0.471181 |  0.36645 |  8.713101 |  0.0 |       0.0 |       0.0 | 0.091021 | 0.668798 | 0.860209 |       0.0 | 1.832306 |      0.0 |  0.0 |  0.0 | 180.055315 |      0.0 |       0.0 | 0.091021 | 0.668798 | 0.860209 | 0.554489 | 0.057749 | 0.073214 | 0.597483 | 0.549371 | 0.508974 |
    | 03.01. |  0.3 | 15.9 | 299.8 |  0.36 | 16.7 | 1.743886 | 0.871943 |       0.0 |  0.0 |     0.36 | 0.507473 |   8.55934 |  0.0 |       0.0 |       0.0 | 0.090028 | 0.644656 | 0.850277 |       0.0 | 1.718578 |      0.0 |  0.0 |  0.0 | 177.962883 |      0.0 |       0.0 | 0.090028 | 0.644656 | 0.850277 | 0.453977 | 0.035026 | 0.074058 | 0.603102 | 0.552415 | 0.477383 |
    | 03.01. |  2.6 | 16.3 | 363.5 |  3.12 | 17.1 | 2.122301 | 1.061151 |      2.32 |  0.0 |      0.8 |  0.25856 |  8.764354 |  0.0 |      2.32 |  1.094569 | 0.088981 | 0.619547 | 0.839814 |  1.094569 | 1.732394 |      0.0 |  0.0 |  0.0 |  177.38141 | 1.086399 |  0.008171 | 0.088981 | 0.619547 | 0.839814 |  0.47343 | 0.022985 | 0.074811 | 0.605842 | 0.555326 | 0.481221 |
    | 03.01. |  0.7 | 16.3 | 368.4 |  0.84 | 17.1 | 2.150411 | 1.075205 |      0.04 |  0.0 |      0.8 | 0.272381 |  8.764354 |  0.0 |      0.04 |  0.018544 | 0.088691 | 0.612629 | 0.836907 |  0.018544 | 1.740398 |      0.0 |  0.0 |  0.0 | 175.592259 | 0.018544 |       0.0 | 0.088691 | 0.612629 | 0.836907 | 0.484534 | 0.015415 | 0.075495 | 0.606811 | 0.558143 | 0.483444 |
    | 03.01. |  0.3 | 16.4 | 317.8 |  0.36 | 17.2 | 1.863566 | 0.931783 |       0.0 |  0.0 |     0.36 | 0.565298 |  8.815608 |  0.0 |       0.0 |       0.0 | 0.087796 | 0.591505 | 0.827961 |       0.0 | 1.651009 |      0.0 |  0.0 |  0.0 | 173.519699 |      0.0 |       0.0 | 0.087796 | 0.591505 | 0.827961 | 0.398328 |  0.00935 | 0.076116 | 0.606343 | 0.560872 | 0.458614 |
    | 03.01. |  0.3 | 16.5 | 534.7 |  0.36 | 17.3 | 3.115838 | 1.557919 |       0.0 |  0.0 |     0.36 | 1.182759 |  8.866861 |  0.0 |       0.0 |       0.0 |  0.08676 | 0.567346 | 0.817598 |       0.0 | 1.575695 |      0.0 |  0.0 |  0.0 | 170.865235 |      0.0 |       0.0 |  0.08676 | 0.567346 | 0.817598 | 0.326123 | 0.005671 | 0.076661 | 0.603762 | 0.563478 | 0.437693 |
    | 03.01. |  0.0 | 18.4 | 319.4 |   0.0 | 19.2 | 1.940627 | 0.970313 |       0.0 |  0.0 |      0.0 | 0.956307 |  9.840678 |  0.0 |       0.0 |       0.0 | 0.085433 | 0.536899 | 0.804326 |       0.0 | 1.512331 |      0.0 |  0.0 |  0.0 |  168.48227 |      0.0 |       0.0 | 0.085433 | 0.536899 | 0.804326 | 0.267007 |  0.00344 |  0.07712 | 0.598824 |  0.56594 | 0.420092 |
    | 03.01. |  0.0 | 18.3 | 350.6 |   0.0 | 19.1 | 2.122768 | 1.061384 |       0.0 |  0.0 |      0.0 | 1.044259 |  9.789425 |  0.0 |       0.0 |       0.0 | 0.084241 | 0.510046 | 0.792411 |       0.0 | 1.458074 |      0.0 |  0.0 |  0.0 | 166.051312 |      0.0 |       0.0 | 0.084241 | 0.510046 | 0.792411 | 0.218607 | 0.002086 | 0.077497 | 0.591632 | 0.568253 | 0.405021 |
    | 03.01. |  0.0 | 18.1 | 215.4 |   0.0 | 18.9 | 1.314414 | 0.657207 |       0.0 |  0.0 |      0.0 | 0.645396 |  9.686918 |  0.0 |       0.0 |       0.0 | 0.083026 | 0.483131 | 0.780257 |       0.0 |  1.41103 |      0.0 |  0.0 |  0.0 | 164.059503 |      0.0 |       0.0 | 0.083026 | 0.483131 | 0.780257 |  0.17898 | 0.001265 | 0.077796 | 0.582566 | 0.570423 | 0.391953 |
    | 03.01. |  0.0 | 16.7 |  97.8 |   0.0 | 17.5 | 0.602486 | 0.301243 |       0.0 |  0.0 |      0.0 | 0.295351 |  8.969368 |  0.0 |       0.0 |       0.0 |  0.08203 | 0.461443 | 0.770298 |       0.0 | 1.369845 |      0.0 |  0.0 |  0.0 | 162.450382 |      0.0 |       0.0 |  0.08203 | 0.461443 | 0.770298 | 0.146537 | 0.000767 | 0.078026 | 0.572054 | 0.572461 | 0.380513 |
    | 03.01. |  0.0 | 15.2 |  13.1 |   0.0 | 16.0 | 0.109905 | 0.054952 |       0.0 |  0.0 |      0.0 | 0.053804 |  8.200565 |  0.0 |       0.0 |       0.0 | 0.081225 | 0.444166 | 0.762252 |       0.0 | 1.333723 |      0.0 |  0.0 |  0.0 | 161.108935 |      0.0 |       0.0 | 0.081225 | 0.444166 | 0.762252 | 0.119974 | 0.000466 | 0.078202 | 0.560693 | 0.574389 | 0.370479 |
    | 03.01. |  0.0 | 13.4 |   0.0 |   0.0 | 14.2 | 0.035026 | 0.017513 |       0.0 |  0.0 |      0.0 | 0.017127 |  7.278002 |  0.0 |       0.0 |       0.0 | 0.080554 | 0.429932 | 0.755545 |       0.0 | 1.301981 |      0.0 |  0.0 |  0.0 | 159.825778 |      0.0 |       0.0 | 0.080554 | 0.429932 | 0.755545 | 0.098226 | 0.000282 | 0.078333 | 0.548915 | 0.576225 | 0.361662 |
    | 03.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.016756 |  6.765466 |  0.0 |       0.0 |       0.0 | 0.079913 | 0.416462 | 0.749129 |       0.0 | 1.273935 |      0.0 |  0.0 |  0.0 | 158.563518 |      0.0 |       0.0 | 0.079913 | 0.416462 | 0.749129 | 0.080421 | 0.000171 | 0.078425 | 0.536941 | 0.577977 | 0.353871 |
    | 03.01. |  0.0 | 11.6 |   0.0 |   0.0 | 12.4 | 0.033727 | 0.016863 |       0.0 |  0.0 |      0.0 | 0.016453 |  6.355438 |  0.0 |       0.0 |       0.0 | 0.079282 | 0.403351 | 0.742818 |       0.0 |  1.24892 |      0.0 |  0.0 |  0.0 | 157.321615 |      0.0 |       0.0 | 0.079282 | 0.403351 | 0.742818 | 0.065843 | 0.000104 | 0.078482 | 0.524841 | 0.579649 | 0.346922 |
    | 03.01. |  0.0 | 11.0 |   0.0 |   0.0 | 11.8 | 0.033286 | 0.016643 |       0.0 |  0.0 |      0.0 | 0.016218 |  6.047917 |  0.0 |       0.0 |       0.0 | 0.078661 | 0.390589 | 0.736608 |       0.0 | 1.226381 |      0.0 |  0.0 |  0.0 | 156.099539 |      0.0 |       0.0 | 0.078661 | 0.390589 | 0.736608 | 0.053908 | 0.000063 | 0.078506 | 0.512663 | 0.581242 | 0.340661 |
    | 04.01. |  0.0 | 10.5 |   0.0 |   0.0 | 11.3 | 0.032916 | 0.016458 |       0.0 |  0.0 |      0.0 | 0.016018 |  5.791649 |  0.0 |       0.0 |       0.0 |  0.07805 | 0.378165 | 0.730498 |       0.0 | 1.205875 |      0.0 |  0.0 |  0.0 | 154.896808 |      0.0 |       0.0 |  0.07805 | 0.378165 | 0.730498 | 0.044136 | 0.000038 | 0.078498 | 0.500445 | 0.582757 | 0.334965 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.016428 |  6.406692 |  0.0 |       0.0 |       0.0 | 0.077448 | 0.366069 | 0.724484 |       0.0 | 1.187041 |      0.0 |  0.0 |  0.0 | 153.712379 |      0.0 |       0.0 | 0.077448 | 0.366069 | 0.724484 | 0.036135 | 0.000023 | 0.078462 | 0.488223 | 0.584197 | 0.329734 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.016478 |  6.509199 |  0.0 |       0.0 |       0.0 | 0.076856 | 0.354286 | 0.718562 |       0.0 | 1.169589 |      0.0 |  0.0 |  0.0 | 152.546197 |      0.0 |       0.0 | 0.076856 | 0.354286 | 0.718562 | 0.029585 | 0.000014 | 0.078398 | 0.476029 | 0.585563 | 0.324886 |
    | 04.01. |  1.3 | 11.2 |   0.0 |  1.56 | 12.0 | 0.033433 | 0.016717 |      0.76 |  0.0 | 0.016717 |      0.0 |  6.150424 |  0.0 |      0.76 |  0.256904 | 0.076273 | 0.342811 | 0.712731 |  0.256904 | 1.177345 | 0.783283 |  0.0 |  0.0 | 151.917478 | 0.256904 |       0.0 | 0.076273 | 0.342811 | 0.712731 | 0.048282 | 0.000009 | 0.078308 | 0.463888 | 0.586858 |  0.32704 |
    | 04.01. |  0.0 | 11.1 |   0.0 |   0.0 | 11.9 |  0.03336 |  0.01668 |       0.0 |  0.0 |  0.01668 |      0.0 |   6.09917 |  0.0 |       0.0 |       0.0 | 0.075959 | 0.336677 | 0.709587 |       0.0 |  1.18041 | 0.766603 |  0.0 |  0.0 | 150.795255 |      0.0 |       0.0 | 0.075959 | 0.336677 | 0.709587 | 0.062039 | 0.000005 | 0.078201 |  0.45207 | 0.588095 | 0.327892 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 | 0.016973 |      0.0 |  6.509199 |  0.0 |       0.0 |       0.0 | 0.075398 |  0.32582 | 0.703976 |       0.0 | 1.158713 |  0.74963 |  0.0 |  0.0 | 149.690062 |      0.0 |       0.0 | 0.075398 |  0.32582 | 0.703976 | 0.050793 | 0.000003 | 0.078078 | 0.440563 | 0.589275 | 0.321865 |
    | 04.01. |  0.0 | 12.2 |  17.0 |   0.0 | 13.0 | 0.124091 | 0.062046 |       0.0 |  0.0 | 0.062046 |      0.0 |  6.662959 |  0.0 |       0.0 |       0.0 | 0.074845 | 0.315244 |  0.69845 |       0.0 | 1.139043 | 0.687585 |  0.0 |  0.0 | 148.601522 |      0.0 |       0.0 | 0.074845 | 0.315244 |  0.69845 | 0.041586 | 0.000002 | 0.077934 | 0.429132 | 0.590389 | 0.316401 |
    | 04.01. |  0.7 | 11.8 |  99.7 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.727585 |  0.0 | 0.278392 |      0.0 |  6.457945 |  0.0 |  0.727585 |   0.23476 | 0.074301 | 0.304942 | 0.693008 |   0.23476 | 1.143038 | 0.521608 |  0.0 |  0.0 | 148.022097 |  0.23476 |       0.0 | 0.074301 | 0.304942 | 0.693008 | 0.056034 | 0.000001 |  0.07777 | 0.417796 | 0.591437 | 0.317511 |
    | 04.01. |  0.4 | 11.4 | 239.4 |  0.48 | 12.2 | 1.278351 | 0.639175 |  0.201608 |  0.0 | 0.639175 |      0.0 |  6.252931 |  0.0 |  0.201608 |  0.064476 | 0.074011 | 0.299505 |  0.69011 |  0.064476 | 1.149305 | 0.160825 |  0.0 |  0.0 | 147.095603 | 0.064476 |       0.0 | 0.074011 | 0.299505 |  0.69011 | 0.072484 | 0.000001 | 0.077594 | 0.406794 | 0.592434 | 0.319251 |
    | 04.01. |  0.1 | 11.6 | 391.2 |  0.12 | 12.4 |  2.07666 |  1.03833 |       0.0 |  0.0 | 0.280825 | 0.729729 |  6.355438 |  0.0 |       0.0 |       0.0 | 0.073548 | 0.290879 | 0.685478 |       0.0 |  1.13195 |      0.0 |  0.0 |  0.0 | 145.315969 |      0.0 |       0.0 | 0.073548 | 0.290879 | 0.685478 | 0.064994 |      0.0 | 0.077407 | 0.396166 | 0.593382 | 0.314431 |
    | 04.01. |  0.4 | 13.0 | 525.6 |  0.48 | 13.8 | 2.862014 | 1.431007 |       0.0 |  0.0 |     0.48 | 0.914014 |  7.072988 |  0.0 |       0.0 |       0.0 | 0.072658 | 0.274549 |  0.67658 |       0.0 | 1.110021 |      0.0 |  0.0 |  0.0 | 143.378168 |      0.0 |       0.0 | 0.072658 | 0.274549 |  0.67658 | 0.053212 |      0.0 | 0.077197 | 0.385357 | 0.594254 | 0.308339 |
    | 04.01. |  0.0 | 17.1 | 570.2 |   0.0 | 17.9 | 3.356573 | 1.678286 |       0.0 |  0.0 |      0.0 | 1.608745 |  9.174382 |  0.0 |       0.0 |       0.0 | 0.071689 | 0.257128 | 0.666891 |       0.0 | 1.089514 |      0.0 |  0.0 |  0.0 | 140.773716 |      0.0 |       0.0 | 0.071689 | 0.257128 | 0.666891 | 0.043567 |      0.0 | 0.076952 |  0.37397 | 0.595025 | 0.302643 |
    | 04.01. |  0.0 | 18.2 | 559.1 |   0.0 | 19.0 | 3.356514 | 1.678257 |       0.0 |  0.0 |      0.0 | 1.602677 |  9.738171 |  0.0 |       0.0 |       0.0 | 0.070387 | 0.234322 | 0.653869 |       0.0 | 1.069756 |      0.0 |  0.0 |  0.0 | 138.212461 |      0.0 |       0.0 | 0.070387 | 0.234322 | 0.653869 | 0.035669 |      0.0 | 0.076663 | 0.361747 | 0.595675 | 0.297154 |
    | 04.01. |  0.0 | 22.4 | 668.0 |   0.0 | 23.2 | 4.286095 | 2.143047 |       0.0 |  0.0 |      0.0 | 2.038476 |  11.89082 |  0.0 |       0.0 |       0.0 | 0.069106 | 0.212594 | 0.641062 |       0.0 |  1.05029 |      0.0 |  0.0 |  0.0 | 135.251223 |      0.0 |       0.0 | 0.069106 | 0.212594 | 0.641062 | 0.029204 |      0.0 | 0.076326 |  0.34857 | 0.596191 | 0.291747 |
    | 04.01. |  0.0 | 21.4 | 593.4 |   0.0 | 22.2 | 3.753358 | 1.876679 |       0.0 |  0.0 |      0.0 | 1.776399 | 11.378284 |  0.0 |       0.0 |       0.0 | 0.067626 | 0.188367 | 0.626256 |       0.0 | 1.030869 |      0.0 |  0.0 |  0.0 | 132.592576 |      0.0 |       0.0 | 0.067626 | 0.188367 | 0.626256 |  0.02391 |      0.0 | 0.075937 | 0.334458 | 0.596563 | 0.286352 |
    | 04.01. |  0.0 | 21.8 | 493.0 |   0.0 | 22.6 | 3.144766 | 1.572383 |       0.0 |  0.0 |      0.0 |  1.48137 | 11.583298 |  0.0 |       0.0 |       0.0 | 0.066296 | 0.167464 | 0.612963 |       0.0 | 1.011412 |      0.0 |  0.0 |  0.0 | 130.264483 |      0.0 |       0.0 | 0.066296 | 0.167464 | 0.612963 | 0.019576 |      0.0 | 0.075499 | 0.319545 | 0.596793 | 0.280948 |
    | 04.01. |  0.0 | 22.2 | 391.2 |   0.0 | 23.0 | 2.519332 | 1.259666 |       0.0 |  0.0 |      0.0 | 1.181556 | 11.788313 |  0.0 |       0.0 |       0.0 | 0.065132 | 0.149845 | 0.601322 |       0.0 | 0.992164 |      0.0 |  0.0 |  0.0 | 128.266628 |      0.0 |       0.0 | 0.065132 | 0.149845 | 0.601322 | 0.016027 |      0.0 | 0.075022 |  0.30422 | 0.596895 | 0.275601 |
    | 04.01. |  0.0 | 20.1 | 186.0 |   0.0 | 20.9 | 1.179367 | 0.589683 |       0.0 |  0.0 |      0.0 | 0.550923 | 10.711988 |  0.0 |       0.0 |       0.0 | 0.064133 | 0.135255 | 0.591333 |       0.0 |  0.97335 |      0.0 |  0.0 |  0.0 | 126.924984 |      0.0 |       0.0 | 0.064133 | 0.135255 | 0.591333 | 0.013122 |      0.0 | 0.074515 | 0.288823 |  0.59689 | 0.270375 |
    | 04.01. |  0.0 | 17.8 |  82.4 |   0.0 | 18.6 | 0.523693 | 0.261846 |       0.0 |  0.0 |      0.0 | 0.243955 |  9.533157 |  0.0 |       0.0 |       0.0 | 0.063462 | 0.125741 | 0.584625 |       0.0 | 0.955286 |      0.0 |  0.0 |  0.0 | 125.907201 |      0.0 |       0.0 | 0.063462 | 0.125741 | 0.584625 | 0.010743 |      0.0 | 0.073992 | 0.273749 | 0.596801 | 0.265357 |
    | 04.01. |  0.0 | 15.2 |  17.0 |   0.0 | 16.0 |  0.13182 |  0.06591 |       0.0 |  0.0 |      0.0 | 0.061273 |  8.200565 |  0.0 |       0.0 |       0.0 | 0.062954 | 0.118679 | 0.579536 |       0.0 | 0.938239 |      0.0 |  0.0 |  0.0 |  125.08476 |      0.0 |       0.0 | 0.062954 | 0.118679 | 0.579536 | 0.008796 |      0.0 | 0.073466 | 0.259323 | 0.596654 | 0.260622 |
    | 04.01. |  0.0 | 14.5 |   0.0 |   0.0 | 15.3 | 0.035803 | 0.017902 |       0.0 |  0.0 |      0.0 | 0.016612 |  7.841791 |  0.0 |       0.0 |       0.0 | 0.062542 | 0.113073 | 0.575424 |       0.0 | 0.922276 |      0.0 |  0.0 |  0.0 | 124.317108 |      0.0 |       0.0 | 0.062542 | 0.113073 | 0.575424 | 0.007202 |      0.0 | 0.072943 | 0.245668 | 0.596464 | 0.256188 |
    | 04.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.015891 |  6.765466 |  0.0 |       0.0 |       0.0 | 0.062159 | 0.107922 | 0.571586 |       0.0 | 0.907358 |      0.0 |  0.0 |  0.0 | 123.559551 |      0.0 |       0.0 | 0.062159 | 0.107922 | 0.571586 | 0.005896 |      0.0 | 0.072427 |   0.2328 | 0.596235 | 0.252044 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.015629 |  6.406692 |  0.0 |       0.0 |       0.0 |  0.06178 | 0.102918 | 0.567798 |       0.0 | 0.893389 |      0.0 |  0.0 |  0.0 | 122.811426 |      0.0 |       0.0 |  0.06178 | 0.102918 | 0.567798 | 0.004827 |      0.0 | 0.071916 | 0.220675 | 0.595971 | 0.248164 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.015669 |  6.509199 |  0.0 |       0.0 |       0.0 | 0.061406 | 0.098055 | 0.564057 |       0.0 |  0.88027 |      0.0 |  0.0 |  0.0 | 122.072239 |      0.0 |       0.0 | 0.061406 | 0.098055 | 0.564057 | 0.003952 |      0.0 | 0.071413 | 0.209233 | 0.595672 |  0.24452 |

    .. raw:: html

        <iframe
            src="lland_v1_ex1.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    .. _lland_v1_ex2_1:

    **Example 2.1**

    HydPy-L-Land defines three types of water areas. The first one, |WASSER|,
    is also implemented in the original LARSIM model.  Precipitation (|NKor|)
    and potential evaporation (|EvPo|) are simply added to and subtracted
    from total discharge (|lland_fluxes.Q|), respectively.

    In the following example, this simple approach has the unfavourable side
    effect of discharge dropping to zero in periods with no precipitation but
    relevant potential evaporation during the daytime.  Comparable problems
    do arise when |WASSER| is only one of many selected land types, possibly
    even when the water area is below 1 % of the total catchment area.  Hence
    it seems advisable to use land type |FLUSS| and/or land type |SEE| instead
    of land type |WASSER| under most circumstances:

    >>> lnk(WASSER)
    >>> test('lland_v1_ex2_1')
    |   date | nied | teml |  glob |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |         q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 | qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |    outlet |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |   0.0 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 | 0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.477367 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497508 |  0.132602 |
    | 01.01. |  0.0 | 19.4 |   0.0 |   0.0 | 20.2 | 0.039121 |  0.01956 |  0.0 |  0.0 |  0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.472998 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492558 |  0.131388 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.468261 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487657 |  0.130072 |
    | 01.01. |  0.0 | 18.3 |   0.0 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.463607 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.482805 |   0.12878 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.458604 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.478001 |   0.12739 |
    | 01.01. |  0.0 | 22.5 |   0.0 |   0.0 | 23.3 | 0.041105 | 0.020552 |  0.0 |  0.0 | 0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.452692 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.473245 |  0.125748 |
    | 01.01. |  0.0 | 25.1 |  11.2 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 | 0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.410154 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.468536 |  0.113932 |
    | 01.01. |  0.0 | 28.3 | 105.5 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 | 0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.077299 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.463874 |  0.021472 |
    | 01.01. |  0.0 | 27.8 | 248.3 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 | 0.459258 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.459258 |       0.0 |
    | 01.01. |  0.0 | 31.4 | 401.3 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 | 0.454688 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.454688 |       0.0 |
    | 01.01. |  0.0 | 32.2 | 449.7 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 | 0.450164 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.450164 |       0.0 |
    | 01.01. |  0.0 | 35.2 | 493.4 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 | 0.445685 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445685 |       0.0 |
    | 01.01. |  0.0 | 37.1 | 261.5 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 |  0.44125 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.44125 |       0.0 |
    | 01.01. |  0.0 | 31.2 | 363.6 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 |  0.43686 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.43686 |       0.0 |
    | 01.01. |  0.0 | 24.3 | 446.2 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 | 0.432513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.432513 |       0.0 |
    | 01.01. |  0.2 | 25.4 | 137.6 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | 0.478302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.189907 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.428209 |  0.052752 |
    | 01.01. |  0.0 | 25.9 | 103.0 |   0.0 | 26.7 | 0.731933 | 0.365967 |  0.0 |  0.0 | 0.365967 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.057982 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.423949 |  0.016106 |
    | 01.01. |  0.0 | 23.7 |  63.7 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | 0.227314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.192416 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.41973 |  0.053449 |
    | 01.01. |  1.3 | 21.6 |  41.4 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 | 0.150197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.825357 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.415554 |  0.507044 |
    | 01.01. |  5.6 | 21.2 |   7.9 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 | 0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   7.08664 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.411419 |  1.968511 |
    | 01.01. |  2.9 | 20.4 |   0.0 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 | 0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.86744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.407325 |  1.074289 |
    | 01.01. |  4.9 | 19.8 |   0.0 |  5.88 | 20.6 | 0.039381 | 0.019691 |  0.0 |  0.0 | 0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.263582 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.403272 |  1.739884 |
    | 01.01. | 10.6 | 19.6 |   0.0 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 | 0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 13.099634 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.39926 |  3.638787 |
    | 01.01. |  0.1 | 19.2 |   0.0 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.495792 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.395287 |   0.13772 |
    | 02.01. |  0.7 | 19.2 |   0.0 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.211859 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.391354 |  0.336628 |
    | 02.01. |  3.0 | 19.2 |   0.0 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.967965 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.38746 |  1.102213 |
    | 02.01. |  2.1 | 18.9 |   0.0 |  2.52 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.884208 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.383605 |  0.801169 |
    | 02.01. | 10.4 | 18.7 |   0.0 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |  0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 12.840457 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.379788 |  3.566794 |
    | 02.01. |  3.5 | 18.5 |   0.0 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 | 0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.556744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.376009 |  1.265762 |
    | 02.01. |  3.4 | 18.3 |   0.0 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.433069 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.372267 |  1.231408 |
    | 02.01. |  1.2 | 18.5 |   6.1 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |  0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.771104 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.368563 |  0.491973 |
    | 02.01. |  0.1 | 18.8 |  77.9 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 | 0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.231973 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.364896 |  0.064437 |
    | 02.01. |  0.0 | 18.8 | 196.7 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 | 0.361265 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.361265 |       0.0 |
    | 02.01. |  0.0 | 19.0 | 121.9 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 | 0.357671 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.357671 |       0.0 |
    | 02.01. |  0.4 | 19.2 | 156.6 |  0.48 | 20.0 | 0.984401 |   0.4922 |  0.0 |  0.0 |   0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.341911 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.354112 |  0.094975 |
    | 02.01. |  0.1 | 19.3 | 404.7 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 | 0.470588 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.350588 |       0.0 |
    | 02.01. |  3.6 | 19.0 | 217.9 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 | 0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.992143 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3471 |  1.108929 |
    | 02.01. |  5.9 | 18.8 | 582.0 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 | 1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  5.659335 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.343646 |  1.572038 |
    | 02.01. |  1.1 | 18.7 | 263.9 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 | 0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.851022 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340227 |  0.236395 |
    | 02.01. | 20.7 | 17.8 | 136.8 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 | 0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  24.75469 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.336841 |  6.876303 |
    | 02.01. | 37.9 | 17.4 | 146.6 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 | 0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 45.365638 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.33349 | 12.601566 |
    | 02.01. |  8.2 | 17.3 | 190.6 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |  0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.594602 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.330172 |  2.665167 |
    | 02.01. |  3.6 | 16.8 | 103.5 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |  0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.328596 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.326886 |  1.202388 |
    | 02.01. |  7.5 | 16.5 |  13.8 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 | 0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.265313 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.323634 |  2.573698 |
    | 02.01. | 18.5 | 16.3 |   0.0 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 | 0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 22.501889 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.320413 |  6.250525 |
    | 02.01. | 15.4 | 16.2 |   0.0 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |  0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 18.778735 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.317225 |  5.216315 |
    | 02.01. |  6.3 | 15.5 |   0.0 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |  0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  7.855819 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.314069 |  2.182172 |
    | 02.01. |  1.9 | 14.6 |   0.0 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.573007 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.310944 |  0.714724 |
    | 03.01. |  4.9 | 14.7 |   0.0 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 | 0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.169878 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.30785 |  1.713855 |
    | 03.01. |  2.7 | 14.6 |   0.0 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.52685 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.304787 |  0.979681 |
    | 03.01. |  0.5 | 14.1 |   0.0 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 | 0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.883993 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.301754 |  0.245554 |
    | 03.01. |  0.2 | 14.3 |   0.0 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 | 0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.52092 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.298752 |    0.1447 |
    | 03.01. |  0.5 | 14.9 |   0.0 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 | 0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.877737 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.295779 |  0.243816 |
    | 03.01. |  2.4 | 15.7 |   0.0 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 | 0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.154517 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.292836 |  0.876255 |
    | 03.01. |  0.4 | 16.0 |   4.4 |  0.48 | 16.8 | 0.061945 | 0.030972 |  0.0 |  0.0 | 0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.73895 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.289922 |  0.205264 |
    | 03.01. |  0.2 | 16.7 |  26.1 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 | 0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.432964 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.287037 |  0.120268 |
    | 03.01. |  0.0 | 17.1 |  74.2 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 | 0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.049436 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.284181 |  0.013732 |
    | 03.01. |  0.0 | 16.2 | 287.1 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 | 0.281354 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.281354 |       0.0 |
    | 03.01. |  0.3 | 15.9 | 299.8 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 | 0.638554 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.278554 |       0.0 |
    | 03.01. |  2.6 | 16.3 | 363.5 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 | 1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.334632 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.275782 |  0.648509 |
    | 03.01. |  0.7 | 16.3 | 368.4 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 | 1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.037833 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.273038 |  0.010509 |
    | 03.01. |  0.3 | 16.4 | 317.8 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 | 0.630322 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.270322 |       0.0 |
    | 03.01. |  0.3 | 16.5 | 534.7 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 | 0.627632 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.267632 |       0.0 |
    | 03.01. |  0.0 | 18.4 | 319.4 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 | 0.264969 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.264969 |       0.0 |
    | 03.01. |  0.0 | 18.3 | 350.6 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 | 0.262332 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.262332 |       0.0 |
    | 03.01. |  0.0 | 18.1 | 215.4 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 | 0.259722 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.259722 |       0.0 |
    | 03.01. |  0.0 | 16.7 |  97.8 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 | 0.257138 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.257138 |       0.0 |
    | 03.01. |  0.0 | 15.2 |  13.1 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | 0.054952 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.199627 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.254579 |  0.055452 |
    | 03.01. |  0.0 | 13.4 |   0.0 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | 0.017513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.234533 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.252046 |  0.065148 |
    | 03.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.232384 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.249538 |  0.064551 |
    | 03.01. |  0.0 | 11.6 |   0.0 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 | 0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.230192 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.247055 |  0.063942 |
    | 03.01. |  0.0 | 11.0 |   0.0 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 | 0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.227954 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.244597 |  0.063321 |
    | 04.01. |  0.0 | 10.5 |   0.0 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 | 0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.225705 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.242163 |  0.062696 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.222854 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.239754 |  0.061904 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.220395 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.237368 |  0.061221 |
    | 04.01. |  1.3 | 11.2 |   0.0 |  1.56 | 12.0 | 0.033433 | 0.016717 |  0.0 |  0.0 | 0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   1.77829 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.235006 |  0.493969 |
    | 04.01. |  0.0 | 11.1 |   0.0 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |  0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.215988 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.232668 |  0.059997 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.21338 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.230353 |  0.059272 |
    | 04.01. |  0.0 | 12.2 |  17.0 |   0.0 | 13.0 | 0.124091 | 0.062046 |  0.0 |  0.0 | 0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.166015 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.228061 |  0.046115 |
    | 04.01. |  0.7 | 11.8 |  99.7 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 | 0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |    0.7874 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.225792 |  0.218722 |
    | 04.01. |  0.4 | 11.4 | 239.4 |  0.48 | 12.2 | 1.278351 | 0.639175 |  0.0 |  0.0 | 0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.06437 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.223545 |   0.01788 |
    | 04.01. |  0.1 | 11.6 | 391.2 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 | 0.341321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.221321 |       0.0 |
    | 04.01. |  0.4 | 13.0 | 525.6 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 | 0.699118 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.219118 |       0.0 |
    | 04.01. |  0.0 | 17.1 | 570.2 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 | 0.216938 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.216938 |       0.0 |
    | 04.01. |  0.0 | 18.2 | 559.1 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 |  0.21478 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.21478 |       0.0 |
    | 04.01. |  0.0 | 22.4 | 668.0 |   0.0 | 23.2 | 4.286095 | 2.143047 |  0.0 |  0.0 | 0.212642 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.212642 |       0.0 |
    | 04.01. |  0.0 | 21.4 | 593.4 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 | 0.210527 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.210527 |       0.0 |
    | 04.01. |  0.0 | 21.8 | 493.0 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 | 0.208432 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.208432 |       0.0 |
    | 04.01. |  0.0 | 22.2 | 391.2 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 | 0.206358 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.206358 |       0.0 |
    | 04.01. |  0.0 | 20.1 | 186.0 |   0.0 | 20.9 | 1.179367 | 0.589683 |  0.0 |  0.0 | 0.204305 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.204305 |       0.0 |
    | 04.01. |  0.0 | 17.8 |  82.4 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 | 0.202272 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.202272 |       0.0 |
    | 04.01. |  0.0 | 15.2 |  17.0 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 |  0.06591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.134349 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.200259 |  0.037319 |
    | 04.01. |  0.0 | 14.5 |   0.0 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | 0.017902 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.180365 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.198267 |  0.050101 |
    | 04.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.17914 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.196294 |  0.049761 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.177441 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.194341 |  0.049289 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.175434 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.192407 |  0.048732 |

    .. raw:: html

        <iframe
            src="lland_v1_ex2_1.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    .. _lland_v1_ex2_2:

    **Example 2.2**

    This modification of example 2 shows the necessary amount of trimming of
    flux sequence |lland_fluxes.Q| by setting parameter |NegQ| to `True`.
    This allows for negative values, resulting in some negative discharge
    peaks (hence set |NegQ| to `True` only for very good reasons):

    >>> negq(True)
    >>> test('lland_v1_ex2_2')
    |   date | nied | teml |  glob |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |         q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 | qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |    outlet |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |   0.0 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 | 0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.477367 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497508 |  0.132602 |
    | 01.01. |  0.0 | 19.4 |   0.0 |   0.0 | 20.2 | 0.039121 |  0.01956 |  0.0 |  0.0 |  0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.472998 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492558 |  0.131388 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.468261 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487657 |  0.130072 |
    | 01.01. |  0.0 | 18.3 |   0.0 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.463607 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.482805 |   0.12878 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.458604 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.478001 |   0.12739 |
    | 01.01. |  0.0 | 22.5 |   0.0 |   0.0 | 23.3 | 0.041105 | 0.020552 |  0.0 |  0.0 | 0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.452692 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.473245 |  0.125748 |
    | 01.01. |  0.0 | 25.1 |  11.2 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 | 0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.410154 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.468536 |  0.113932 |
    | 01.01. |  0.0 | 28.3 | 105.5 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 | 0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.077299 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.463874 |  0.021472 |
    | 01.01. |  0.0 | 27.8 | 248.3 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 | 0.873907 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.414649 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.459258 |  -0.11518 |
    | 01.01. |  0.0 | 31.4 | 401.3 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 | 1.463511 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.008823 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.454688 | -0.280229 |
    | 01.01. |  0.0 | 32.2 | 449.7 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 | 1.652872 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.202708 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.450164 | -0.334086 |
    | 01.01. |  0.0 | 35.2 | 493.4 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 | 1.873973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.428288 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445685 | -0.396747 |
    | 01.01. |  0.0 | 37.1 | 261.5 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 | 1.025236 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.583985 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.44125 | -0.162218 |
    | 01.01. |  0.0 | 31.2 | 363.6 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 | 1.325006 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.888146 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.43686 | -0.246707 |
    | 01.01. |  0.0 | 24.3 | 446.2 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 | 1.479524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.047011 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.432513 | -0.290836 |
    | 01.01. |  0.2 | 25.4 | 137.6 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | 0.478302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.189907 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.428209 |  0.052752 |
    | 01.01. |  0.0 | 25.9 | 103.0 |   0.0 | 26.7 | 0.731933 | 0.365967 |  0.0 |  0.0 | 0.365967 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.057982 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.423949 |  0.016106 |
    | 01.01. |  0.0 | 23.7 |  63.7 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | 0.227314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.192416 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.41973 |  0.053449 |
    | 01.01. |  1.3 | 21.6 |  41.4 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 | 0.150197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.825357 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.415554 |  0.507044 |
    | 01.01. |  5.6 | 21.2 |   7.9 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 | 0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   7.08664 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.411419 |  1.968511 |
    | 01.01. |  2.9 | 20.4 |   0.0 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 | 0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.86744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.407325 |  1.074289 |
    | 01.01. |  4.9 | 19.8 |   0.0 |  5.88 | 20.6 | 0.039381 | 0.019691 |  0.0 |  0.0 | 0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.263582 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.403272 |  1.739884 |
    | 01.01. | 10.6 | 19.6 |   0.0 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 | 0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 13.099634 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.39926 |  3.638787 |
    | 01.01. |  0.1 | 19.2 |   0.0 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.495792 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.395287 |   0.13772 |
    | 02.01. |  0.7 | 19.2 |   0.0 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.211859 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.391354 |  0.336628 |
    | 02.01. |  3.0 | 19.2 |   0.0 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.967965 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.38746 |  1.102213 |
    | 02.01. |  2.1 | 18.9 |   0.0 |  2.52 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.884208 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.383605 |  0.801169 |
    | 02.01. | 10.4 | 18.7 |   0.0 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |  0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 12.840457 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.379788 |  3.566794 |
    | 02.01. |  3.5 | 18.5 |   0.0 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 | 0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.556744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.376009 |  1.265762 |
    | 02.01. |  3.4 | 18.3 |   0.0 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.433069 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.372267 |  1.231408 |
    | 02.01. |  1.2 | 18.5 |   6.1 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |  0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.771104 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.368563 |  0.491973 |
    | 02.01. |  0.1 | 18.8 |  77.9 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 | 0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.231973 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.364896 |  0.064437 |
    | 02.01. |  0.0 | 18.8 | 196.7 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 | 0.609108 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.247842 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.361265 | -0.068845 |
    | 02.01. |  0.0 | 19.0 | 121.9 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 | 0.386152 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.028481 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.357671 | -0.007911 |
    | 02.01. |  0.4 | 19.2 | 156.6 |  0.48 | 20.0 | 0.984401 |   0.4922 |  0.0 |  0.0 |   0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.341911 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.354112 |  0.094975 |
    | 02.01. |  0.1 | 19.3 | 404.7 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 | 1.243189 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.772601 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.350588 | -0.214611 |
    | 02.01. |  3.6 | 19.0 | 217.9 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 | 0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.992143 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3471 |  1.108929 |
    | 02.01. |  5.9 | 18.8 | 582.0 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 | 1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  5.659335 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.343646 |  1.572038 |
    | 02.01. |  1.1 | 18.7 | 263.9 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 | 0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.851022 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340227 |  0.236395 |
    | 02.01. | 20.7 | 17.8 | 136.8 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 | 0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  24.75469 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.336841 |  6.876303 |
    | 02.01. | 37.9 | 17.4 | 146.6 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 | 0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 45.365638 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.33349 | 12.601566 |
    | 02.01. |  8.2 | 17.3 | 190.6 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |  0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.594602 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.330172 |  2.665167 |
    | 02.01. |  3.6 | 16.8 | 103.5 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |  0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.328596 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.326886 |  1.202388 |
    | 02.01. |  7.5 | 16.5 |  13.8 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 | 0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.265313 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.323634 |  2.573698 |
    | 02.01. | 18.5 | 16.3 |   0.0 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 | 0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 22.501889 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.320413 |  6.250525 |
    | 02.01. | 15.4 | 16.2 |   0.0 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |  0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 18.778735 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.317225 |  5.216315 |
    | 02.01. |  6.3 | 15.5 |   0.0 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |  0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  7.855819 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.314069 |  2.182172 |
    | 02.01. |  1.9 | 14.6 |   0.0 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.573007 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.310944 |  0.714724 |
    | 03.01. |  4.9 | 14.7 |   0.0 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 | 0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.169878 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.30785 |  1.713855 |
    | 03.01. |  2.7 | 14.6 |   0.0 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.52685 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.304787 |  0.979681 |
    | 03.01. |  0.5 | 14.1 |   0.0 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 | 0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.883993 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.301754 |  0.245554 |
    | 03.01. |  0.2 | 14.3 |   0.0 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 | 0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.52092 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.298752 |    0.1447 |
    | 03.01. |  0.5 | 14.9 |   0.0 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 | 0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.877737 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.295779 |  0.243816 |
    | 03.01. |  2.4 | 15.7 |   0.0 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 | 0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.154517 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.292836 |  0.876255 |
    | 03.01. |  0.4 | 16.0 |   4.4 |  0.48 | 16.8 | 0.061945 | 0.030972 |  0.0 |  0.0 | 0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.73895 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.289922 |  0.205264 |
    | 03.01. |  0.2 | 16.7 |  26.1 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 | 0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.432964 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.287037 |  0.120268 |
    | 03.01. |  0.0 | 17.1 |  74.2 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 | 0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.049436 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.284181 |  0.013732 |
    | 03.01. |  0.0 | 16.2 | 287.1 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 | 0.840459 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.559106 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.281354 | -0.155307 |
    | 03.01. |  0.3 | 15.9 | 299.8 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 | 0.871943 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.233389 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.278554 |  -0.06483 |
    | 03.01. |  2.6 | 16.3 | 363.5 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 | 1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.334632 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.275782 |  0.648509 |
    | 03.01. |  0.7 | 16.3 | 368.4 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 | 1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.037833 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.273038 |  0.010509 |
    | 03.01. |  0.3 | 16.4 | 317.8 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 | 0.931783 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.301461 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.270322 | -0.083739 |
    | 03.01. |  0.3 | 16.5 | 534.7 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 | 1.557919 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.930287 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.267632 | -0.258413 |
    | 03.01. |  0.0 | 18.4 | 319.4 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 | 0.970313 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.705345 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.264969 | -0.195929 |
    | 03.01. |  0.0 | 18.3 | 350.6 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 | 1.061384 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.799052 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.262332 | -0.221959 |
    | 03.01. |  0.0 | 18.1 | 215.4 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 | 0.657207 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.397485 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.259722 | -0.110413 |
    | 03.01. |  0.0 | 16.7 |  97.8 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 | 0.301243 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.044105 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.257138 | -0.012251 |
    | 03.01. |  0.0 | 15.2 |  13.1 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | 0.054952 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.199627 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.254579 |  0.055452 |
    | 03.01. |  0.0 | 13.4 |   0.0 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | 0.017513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.234533 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.252046 |  0.065148 |
    | 03.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.232384 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.249538 |  0.064551 |
    | 03.01. |  0.0 | 11.6 |   0.0 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 | 0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.230192 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.247055 |  0.063942 |
    | 03.01. |  0.0 | 11.0 |   0.0 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 | 0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.227954 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.244597 |  0.063321 |
    | 04.01. |  0.0 | 10.5 |   0.0 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 | 0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.225705 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.242163 |  0.062696 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.222854 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.239754 |  0.061904 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.220395 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.237368 |  0.061221 |
    | 04.01. |  1.3 | 11.2 |   0.0 |  1.56 | 12.0 | 0.033433 | 0.016717 |  0.0 |  0.0 | 0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   1.77829 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.235006 |  0.493969 |
    | 04.01. |  0.0 | 11.1 |   0.0 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |  0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.215988 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.232668 |  0.059997 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.21338 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.230353 |  0.059272 |
    | 04.01. |  0.0 | 12.2 |  17.0 |   0.0 | 13.0 | 0.124091 | 0.062046 |  0.0 |  0.0 | 0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.166015 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.228061 |  0.046115 |
    | 04.01. |  0.7 | 11.8 |  99.7 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 | 0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |    0.7874 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.225792 |  0.218722 |
    | 04.01. |  0.4 | 11.4 | 239.4 |  0.48 | 12.2 | 1.278351 | 0.639175 |  0.0 |  0.0 | 0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.06437 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.223545 |   0.01788 |
    | 04.01. |  0.1 | 11.6 | 391.2 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 |  1.03833 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  -0.69701 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.221321 | -0.193614 |
    | 04.01. |  0.4 | 13.0 | 525.6 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 | 1.431007 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.731889 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.219118 | -0.203302 |
    | 04.01. |  0.0 | 17.1 | 570.2 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 | 1.678286 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.461348 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.216938 |  -0.40593 |
    | 04.01. |  0.0 | 18.2 | 559.1 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 | 1.678257 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.463478 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.21478 | -0.406522 |
    | 04.01. |  0.0 | 22.4 | 668.0 |   0.0 | 23.2 | 4.286095 | 2.143047 |  0.0 |  0.0 | 2.143047 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.930405 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.212642 | -0.536224 |
    | 04.01. |  0.0 | 21.4 | 593.4 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 | 1.876679 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.666152 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.210527 |  -0.46282 |
    | 04.01. |  0.0 | 21.8 | 493.0 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 | 1.572383 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.363951 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.208432 | -0.378875 |
    | 04.01. |  0.0 | 22.2 | 391.2 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 | 1.259666 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.053308 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.206358 | -0.292586 |
    | 04.01. |  0.0 | 20.1 | 186.0 |   0.0 | 20.9 | 1.179367 | 0.589683 |  0.0 |  0.0 | 0.589683 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.385379 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.204305 |  -0.10705 |
    | 04.01. |  0.0 | 17.8 |  82.4 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 | 0.261846 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.059575 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.202272 | -0.016548 |
    | 04.01. |  0.0 | 15.2 |  17.0 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 |  0.06591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.134349 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.200259 |  0.037319 |
    | 04.01. |  0.0 | 14.5 |   0.0 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | 0.017902 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.180365 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.198267 |  0.050101 |
    | 04.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.17914 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.196294 |  0.049761 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.177441 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.194341 |  0.049289 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.175434 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.192407 |  0.048732 |

    .. raw:: html

        <iframe
            src="lland_v1_ex2_2.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    >>> negq(False)

    .. _lland_v1_ex3:

    **Example 3**

    As an alternative for water type |WASSER|, HydPy-L offers water type |SEE|
    for representing lakes not directly connected to the stream network, but
    to the groundwater.  In some aggreement with the implementation of
    "internal lakes" in the HBV96 model (see |hland|), precipitation and
    evaporation values of |SEE| HRUs are directly added and removed from the
    input of the linear storage for base flow (|QBGZ|).  Hence, defining
    |SEE| HRUs results in a reduced responsiveness of a catchment:

    >>> lnk(SEE)
    >>> test('lland_v1_ex3')
    |   date | nied | teml |  glob |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |        q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 |      qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |   outlet |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |   0.0 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 | 0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.497408 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.020141 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497408 | 0.138169 |
    | 01.01. |  0.0 | 19.4 |   0.0 |   0.0 | 20.2 | 0.039121 |  0.01956 |  0.0 |  0.0 |  0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.492261 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.01956 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492261 | 0.136739 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.487169 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.019396 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487169 | 0.135325 |
    | 01.01. |  0.0 | 18.3 |   0.0 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.48213 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.019198 |   0.0 |   0.0 |   0.0 |   0.0 |  0.48213 | 0.133925 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.477141 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.019396 |   0.0 |   0.0 |   0.0 |   0.0 | 0.477141 | 0.132539 |
    | 01.01. |  0.0 | 22.5 |   0.0 |   0.0 | 23.3 | 0.041105 | 0.020552 |  0.0 |  0.0 | 0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.472194 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.020552 |   0.0 |   0.0 |   0.0 |   0.0 | 0.472194 | 0.131165 |
    | 01.01. |  0.0 | 25.1 |  11.2 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 | 0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.467103 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.058382 |   0.0 |   0.0 |   0.0 |   0.0 | 0.467103 | 0.129751 |
    | 01.01. |  0.0 | 28.3 | 105.5 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 | 0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.460239 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.386575 |   0.0 |   0.0 |   0.0 |   0.0 | 0.460239 | 0.127844 |
    | 01.01. |  0.0 | 27.8 | 248.3 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 | 0.873907 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.449384 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.873907 |   0.0 |   0.0 |   0.0 |   0.0 | 0.449384 | 0.124829 |
    | 01.01. |  0.0 | 31.4 | 401.3 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 | 1.463511 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.433279 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.463511 |   0.0 |   0.0 |   0.0 |   0.0 | 0.433279 | 0.120355 |
    | 01.01. |  0.0 | 32.2 | 449.7 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 | 1.652872 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.413462 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.652872 |   0.0 |   0.0 |   0.0 |   0.0 | 0.413462 | 0.114851 |
    | 01.01. |  0.0 | 35.2 | 493.4 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 | 1.873973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.3918 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.873973 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3918 | 0.108833 |
    | 01.01. |  0.0 | 37.1 | 261.5 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 | 1.025236 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.373484 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.025236 |   0.0 |   0.0 |   0.0 |   0.0 | 0.373484 | 0.103746 |
    | 01.01. |  0.0 | 31.2 | 363.6 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 | 1.325006 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.358073 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.325006 |   0.0 |   0.0 |   0.0 |   0.0 | 0.358073 | 0.099465 |
    | 01.01. |  0.0 | 24.3 | 446.2 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 | 1.479524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.340556 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.479524 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340556 | 0.094599 |
    | 01.01. |  0.2 | 25.4 | 137.6 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | 0.478302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.328631 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.238302 |   0.0 |   0.0 |   0.0 |   0.0 | 0.328631 | 0.091287 |
    | 01.01. |  0.0 | 25.9 | 103.0 |   0.0 | 26.7 | 0.731933 | 0.365967 |  0.0 |  0.0 | 0.365967 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.322354 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.365967 |   0.0 |   0.0 |   0.0 |   0.0 | 0.322354 | 0.089543 |
    | 01.01. |  0.0 | 23.7 |  63.7 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | 0.227314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.316196 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.227314 |   0.0 |   0.0 |   0.0 |   0.0 | 0.316196 | 0.087832 |
    | 01.01. |  1.3 | 21.6 |  41.4 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 | 0.150197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.318947 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  1.409803 |   0.0 |   0.0 |   0.0 |   0.0 | 0.318947 | 0.088596 |
    | 01.01. |  5.6 | 21.2 |   7.9 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 | 0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.35604 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  6.675221 |   0.0 |   0.0 |   0.0 |   0.0 |  0.35604 |   0.0989 |
    | 01.01. |  2.9 | 20.4 |   0.0 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 | 0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.402895 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.460115 |   0.0 |   0.0 |   0.0 |   0.0 | 0.402895 | 0.111915 |
    | 01.01. |  4.9 | 19.8 |   0.0 |  5.88 | 20.6 | 0.039381 | 0.019691 |  0.0 |  0.0 | 0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.445276 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  5.860309 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445276 | 0.123688 |
    | 01.01. | 10.6 | 19.6 |   0.0 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 | 0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.533243 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 12.700374 |   0.0 |   0.0 |   0.0 |   0.0 | 0.533243 | 0.148123 |
    | 01.01. |  0.1 | 19.2 |   0.0 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.591518 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.100505 |   0.0 |   0.0 |   0.0 |   0.0 | 0.591518 | 0.164311 |
    | 02.01. |  0.7 | 19.2 |   0.0 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.590221 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.820505 |   0.0 |   0.0 |   0.0 |   0.0 | 0.590221 |  0.16395 |
    | 02.01. |  3.0 | 19.2 |   0.0 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.606266 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.580505 |   0.0 |   0.0 |   0.0 |   0.0 | 0.606266 | 0.168407 |
    | 02.01. |  2.1 | 18.9 |   0.0 |  2.52 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.630479 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.500604 |   0.0 |   0.0 |   0.0 |   0.0 | 0.630479 | 0.175133 |
    | 02.01. | 10.4 | 18.7 |   0.0 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |  0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.698722 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  12.46067 |   0.0 |   0.0 |   0.0 |   0.0 | 0.698722 | 0.194089 |
    | 02.01. |  3.5 | 18.5 |   0.0 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 | 0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.774493 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  4.180736 |   0.0 |   0.0 |   0.0 |   0.0 | 0.774493 | 0.215137 |
    | 02.01. |  3.4 | 18.3 |   0.0 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.807788 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  4.060802 |   0.0 |   0.0 |   0.0 |   0.0 | 0.807788 | 0.224386 |
    | 02.01. |  1.2 | 18.5 |   6.1 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |  0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.826909 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   1.40254 |   0.0 |   0.0 |   0.0 |   0.0 | 0.826909 | 0.229697 |
    | 02.01. |  0.1 | 18.8 |  77.9 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 | 0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.824985 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.132922 |   0.0 |   0.0 |   0.0 |   0.0 | 0.824985 | 0.229162 |
    | 02.01. |  0.0 | 18.8 | 196.7 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 | 0.609108 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.81308 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.609108 |   0.0 |   0.0 |   0.0 |   0.0 |  0.81308 | 0.225856 |
    | 02.01. |  0.0 | 19.0 | 121.9 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 | 0.386152 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.80004 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.386152 |   0.0 |   0.0 |   0.0 |   0.0 |  0.80004 | 0.222233 |
    | 02.01. |  0.4 | 19.2 | 156.6 |  0.48 | 20.0 | 0.984401 |   0.4922 |  0.0 |  0.0 |   0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.790101 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   -0.0122 |   0.0 |   0.0 |   0.0 |   0.0 | 0.790101 | 0.219473 |
    | 02.01. |  0.1 | 19.3 | 404.7 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 | 1.243189 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.776582 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.123189 |   0.0 |   0.0 |   0.0 |   0.0 | 0.776582 | 0.215717 |
    | 02.01. |  3.6 | 19.0 | 217.9 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 | 0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.78144 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.645043 |   0.0 |   0.0 |   0.0 |   0.0 |  0.78144 | 0.217067 |
    | 02.01. |  5.9 | 18.8 | 582.0 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 | 1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.818259 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  5.315689 |   0.0 |   0.0 |   0.0 |   0.0 | 0.818259 | 0.227294 |
    | 02.01. |  1.1 | 18.7 | 263.9 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 | 0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.839065 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.510795 |   0.0 |   0.0 |   0.0 |   0.0 | 0.839065 | 0.233074 |
    | 02.01. | 20.7 | 17.8 | 136.8 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 | 0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.954936 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 24.417849 |   0.0 |   0.0 |   0.0 |   0.0 | 0.954936 |  0.26526 |
    | 02.01. | 37.9 | 17.4 | 146.6 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 | 0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.291125 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 45.032149 |   0.0 |   0.0 |   0.0 |   0.0 | 1.291125 | 0.358646 |
    | 02.01. |  8.2 | 17.3 | 190.6 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |  0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.548111 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   9.26443 |   0.0 |   0.0 |   0.0 |   0.0 | 1.548111 | 0.430031 |
    | 02.01. |  3.6 | 16.8 | 103.5 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |  0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.598664 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   4.00171 |   0.0 |   0.0 |   0.0 |   0.0 | 1.598664 | 0.444073 |
    | 02.01. |  7.5 | 16.5 |  13.8 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 | 0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.647192 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  8.941679 |   0.0 |   0.0 |   0.0 |   0.0 | 1.647192 | 0.457553 |
    | 02.01. | 18.5 | 16.3 |   0.0 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 | 0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.785753 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 22.181476 |   0.0 |   0.0 |   0.0 |   0.0 | 1.785753 | 0.496042 |
    | 02.01. | 15.4 | 16.2 |   0.0 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |  0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.970156 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  18.46151 |   0.0 |   0.0 |   0.0 |   0.0 | 1.970156 | 0.547265 |
    | 02.01. |  6.3 | 15.5 |   0.0 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |  0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.07983 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   7.54175 |   0.0 |   0.0 |   0.0 |   0.0 |  2.07983 | 0.577731 |
    | 02.01. |  1.9 | 14.6 |   0.0 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.107866 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.262063 |   0.0 |   0.0 |   0.0 |   0.0 | 2.107866 | 0.585518 |
    | 03.01. |  4.9 | 14.7 |   0.0 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 | 0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.127341 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  5.862028 |   0.0 |   0.0 |   0.0 |   0.0 | 2.127341 | 0.590928 |
    | 03.01. |  2.7 | 14.6 |   0.0 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.151345 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.222063 |   0.0 |   0.0 |   0.0 |   0.0 | 2.151345 | 0.597596 |
    | 03.01. |  0.5 | 14.1 |   0.0 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 | 0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.148844 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.582239 |   0.0 |   0.0 |   0.0 |   0.0 | 2.148844 | 0.596901 |
    | 03.01. |  0.2 | 14.3 |   0.0 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 | 0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.131462 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.222169 |   0.0 |   0.0 |   0.0 |   0.0 | 2.131462 | 0.592073 |
    | 03.01. |  0.5 | 14.9 |   0.0 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 | 0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.114257 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.581959 |   0.0 |   0.0 |   0.0 |   0.0 | 2.114257 | 0.587294 |
    | 03.01. |  2.4 | 15.7 |   0.0 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 | 0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.110371 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.861681 |   0.0 |   0.0 |   0.0 |   0.0 | 2.110371 | 0.586214 |
    | 03.01. |  0.4 | 16.0 |   4.4 |  0.48 | 16.8 | 0.061945 | 0.030972 |  0.0 |  0.0 | 0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.105823 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.449028 |   0.0 |   0.0 |   0.0 |   0.0 | 2.105823 | 0.584951 |
    | 03.01. |  0.2 | 16.7 |  26.1 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 | 0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.087828 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.145926 |   0.0 |   0.0 |   0.0 |   0.0 | 2.087828 | 0.579952 |
    | 03.01. |  0.0 | 17.1 |  74.2 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 | 0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.066608 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.234745 |   0.0 |   0.0 |   0.0 |   0.0 | 2.066608 | 0.574058 |
    | 03.01. |  0.0 | 16.2 | 287.1 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 | 0.840459 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.040691 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.840459 |   0.0 |   0.0 |   0.0 |   0.0 | 2.040691 | 0.566859 |
    | 03.01. |  0.3 | 15.9 | 299.8 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 | 0.871943 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.01366 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.511943 |   0.0 |   0.0 |   0.0 |   0.0 |  2.01366 |  0.55935 |
    | 03.01. |  2.6 | 16.3 | 363.5 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 | 1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.001341 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.058849 |   0.0 |   0.0 |   0.0 |   0.0 | 2.001341 | 0.555928 |
    | 03.01. |  0.7 | 16.3 | 368.4 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 | 1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.990481 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.235205 |   0.0 |   0.0 |   0.0 |   0.0 | 1.990481 | 0.552911 |
    | 03.01. |  0.3 | 16.4 | 317.8 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 | 0.931783 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.966658 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.571783 |   0.0 |   0.0 |   0.0 |   0.0 | 1.966658 | 0.546294 |
    | 03.01. |  0.3 | 16.5 | 534.7 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 | 1.557919 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.93828 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.197919 |   0.0 |   0.0 |   0.0 |   0.0 |  1.93828 | 0.538411 |
    | 03.01. |  0.0 | 18.4 | 319.4 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 | 0.970313 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.908208 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.970313 |   0.0 |   0.0 |   0.0 |   0.0 | 1.908208 | 0.530058 |
    | 03.01. |  0.0 | 18.3 | 350.6 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 | 1.061384 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.879113 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.061384 |   0.0 |   0.0 |   0.0 |   0.0 | 1.879113 | 0.521976 |
    | 03.01. |  0.0 | 18.1 | 215.4 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 | 0.657207 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.851869 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.657207 |   0.0 |   0.0 |   0.0 |   0.0 | 1.851869 | 0.514408 |
    | 03.01. |  0.0 | 16.7 |  97.8 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 | 0.301243 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.828677 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.301243 |   0.0 |   0.0 |   0.0 |   0.0 | 1.828677 | 0.507966 |
    | 03.01. |  0.0 | 15.2 |  13.1 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | 0.054952 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.808711 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.054952 |   0.0 |   0.0 |   0.0 |   0.0 | 1.808711 |  0.50242 |
    | 03.01. |  0.0 | 13.4 |   0.0 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | 0.017513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.790354 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017513 |   0.0 |   0.0 |   0.0 |   0.0 | 1.790354 | 0.497321 |
    | 03.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.772367 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017154 |   0.0 |   0.0 |   0.0 |   0.0 | 1.772367 | 0.492324 |
    | 03.01. |  0.0 | 11.6 |   0.0 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 | 0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.754562 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016863 |   0.0 |   0.0 |   0.0 |   0.0 | 1.754562 | 0.487378 |
    | 03.01. |  0.0 | 11.0 |   0.0 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 | 0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.736938 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016643 |   0.0 |   0.0 |   0.0 |   0.0 | 1.736938 | 0.482483 |
    | 04.01. |  0.0 | 10.5 |   0.0 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 | 0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.71949 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016458 |   0.0 |   0.0 |   0.0 |   0.0 |  1.71949 | 0.477636 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.702215 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   -0.0169 |   0.0 |   0.0 |   0.0 |   0.0 | 1.702215 | 0.472837 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.685109 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016973 |   0.0 |   0.0 |   0.0 |   0.0 | 1.685109 | 0.468086 |
    | 04.01. |  1.3 | 11.2 |   0.0 |  1.56 | 12.0 | 0.033433 | 0.016717 |  0.0 |  0.0 | 0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.675948 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  1.543283 |   0.0 |   0.0 |   0.0 |   0.0 | 1.675948 | 0.465541 |
    | 04.01. |  0.0 | 11.1 |   0.0 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |  0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.666854 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.01668 |   0.0 |   0.0 |   0.0 |   0.0 | 1.666854 | 0.463015 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.650102 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016973 |   0.0 |   0.0 |   0.0 |   0.0 | 1.650102 | 0.458362 |
    | 04.01. |  0.0 | 12.2 |  17.0 |   0.0 | 13.0 | 0.124091 | 0.062046 |  0.0 |  0.0 | 0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.633289 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.062046 |   0.0 |   0.0 |   0.0 |   0.0 | 1.633289 | 0.453691 |
    | 04.01. |  0.7 | 11.8 |  99.7 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 | 0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.619528 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.561608 |   0.0 |   0.0 |   0.0 |   0.0 | 1.619528 | 0.449869 |
    | 04.01. |  0.4 | 11.4 | 239.4 |  0.48 | 12.2 | 1.278351 | 0.639175 |  0.0 |  0.0 | 0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.60541 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.159175 |   0.0 |   0.0 |   0.0 |   0.0 |  1.60541 | 0.445947 |
    | 04.01. |  0.1 | 11.6 | 391.2 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 |  1.03833 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.584069 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.91833 |   0.0 |   0.0 |   0.0 |   0.0 | 1.584069 | 0.440019 |
    | 04.01. |  0.4 | 13.0 | 525.6 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 | 1.431007 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.559007 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.951007 |   0.0 |   0.0 |   0.0 |   0.0 | 1.559007 | 0.433057 |
    | 04.01. |  0.0 | 17.1 | 570.2 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 | 1.678286 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.530407 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.678286 |   0.0 |   0.0 |   0.0 |   0.0 | 1.530407 | 0.425113 |
    | 04.01. |  0.0 | 18.2 | 559.1 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 | 1.678257 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.49848 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.678257 |   0.0 |   0.0 |   0.0 |   0.0 |  1.49848 | 0.416245 |
    | 04.01. |  0.0 | 22.4 | 668.0 |   0.0 | 23.2 | 4.286095 | 2.143047 |  0.0 |  0.0 | 2.143047 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.464555 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -2.143047 |   0.0 |   0.0 |   0.0 |   0.0 | 1.464555 | 0.406821 |
    | 04.01. |  0.0 | 21.4 | 593.4 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 | 1.876679 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.429986 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.876679 |   0.0 |   0.0 |   0.0 |   0.0 | 1.429986 | 0.397218 |
    | 04.01. |  0.0 | 21.8 | 493.0 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 | 1.572383 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.398601 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.572383 |   0.0 |   0.0 |   0.0 |   0.0 | 1.398601 |   0.3885 |
    | 04.01. |  0.0 | 22.2 | 391.2 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 | 1.259666 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.370597 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.259666 |   0.0 |   0.0 |   0.0 |   0.0 | 1.370597 | 0.380722 |
    | 04.01. |  0.0 | 20.1 | 186.0 |   0.0 | 20.9 | 1.179367 | 0.589683 |  0.0 |  0.0 | 0.589683 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.347765 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.589683 |   0.0 |   0.0 |   0.0 |   0.0 | 1.347765 | 0.374379 |
    | 04.01. |  0.0 | 17.8 |  82.4 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 | 0.261846 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.330121 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.261846 |   0.0 |   0.0 |   0.0 |   0.0 | 1.330121 | 0.369478 |
    | 04.01. |  0.0 | 15.2 |  17.0 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 |  0.06591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.315257 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.06591 |   0.0 |   0.0 |   0.0 |   0.0 | 1.315257 | 0.365349 |
    | 04.01. |  0.0 | 14.5 |   0.0 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | 0.017902 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.301753 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017902 |   0.0 |   0.0 |   0.0 |   0.0 | 1.301753 | 0.361598 |
    | 04.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.288626 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017154 |   0.0 |   0.0 |   0.0 |   0.0 | 1.288626 | 0.357952 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.275634 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   -0.0169 |   0.0 |   0.0 |   0.0 |   0.0 | 1.275634 | 0.354343 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.262773 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016973 |   0.0 |   0.0 |   0.0 |   0.0 | 1.262773 |  0.35077 |

    .. raw:: html

        <iframe
            src="lland_v1_ex3.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    .. _lland_v1_ex4:

    **Example 4**

    The second alternative for water type |WASSER| is water type |FLUSS|
    for representing streams.  Precipitation and evaporation values of
    |FLUSS| HRUs are directly added and removed from the (not yet separated)
    input of the linear storages for direct flow (|QDGZ|).  In contrast
    to water type |SEE|, defining HRUs of type |FLUSS| increases the
    responsiveness of a catchment, but to a lessen extent than type |WASSER|.
    This lessens the discussed problem during low flow conditions, but for
    catchments with a very dense stream network, it may still persist.
    Click on the series |EvI| to see how evaporation values have to be
    adjusted belatedly in the most extreme case of an "stream network only"
    catchment:

    >>> lnk(FLUSS)
    >>> test('lland_v1_ex4')
    |   date | nied | teml |  glob |  nkor | tkor |      et0 |     evpo | nbes | sbes |       evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb |      qdgz |         q | inzp | wats | waes | bowa |     qdgz1 |     qdgz2 | qigz1 | qigz2 | qbgz |     qdga1 |     qdga2 | qiga1 | qiga2 |     qbga |   outlet |
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |   0.0 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 |  0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.020141 |  0.495622 |  0.0 |  0.0 |  0.0 |  0.0 | -0.020141 |       0.0 |   0.0 |   0.0 |  0.0 | -0.001886 |       0.0 |   0.0 |   0.0 | 0.497508 | 0.137673 |
    | 01.01. |  0.0 | 19.4 |   0.0 |   0.0 | 20.2 | 0.039121 |  0.01956 |  0.0 |  0.0 |   0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.01956 |  0.487417 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.01956 |       0.0 |   0.0 |   0.0 |  0.0 | -0.005141 |       0.0 |   0.0 |   0.0 | 0.492558 | 0.135394 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 |  0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.019396 |  0.479918 |  0.0 |  0.0 |  0.0 |  0.0 | -0.019396 |       0.0 |   0.0 |   0.0 |  0.0 | -0.007739 |       0.0 |   0.0 |   0.0 | 0.487657 |  0.13331 |
    | 01.01. |  0.0 | 18.3 |   0.0 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 |  0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.019198 |  0.472971 |  0.0 |  0.0 |  0.0 |  0.0 | -0.019198 |       0.0 |   0.0 |   0.0 |  0.0 | -0.009834 |       0.0 |   0.0 |   0.0 | 0.482805 | 0.131381 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 |  0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.019396 |  0.466451 |  0.0 |  0.0 |  0.0 |  0.0 | -0.019396 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.01155 |       0.0 |   0.0 |   0.0 | 0.478001 |  0.12957 |
    | 01.01. |  0.0 | 22.5 |   0.0 |   0.0 | 23.3 | 0.041105 | 0.020552 |  0.0 |  0.0 |  0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.020552 |  0.460164 |  0.0 |  0.0 |  0.0 |  0.0 | -0.020552 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.01308 |       0.0 |   0.0 |   0.0 | 0.473245 | 0.127823 |
    | 01.01. |  0.0 | 25.1 |  11.2 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 |  0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.058382 |  0.450558 |  0.0 |  0.0 |  0.0 |  0.0 | -0.058382 |       0.0 |   0.0 |   0.0 |  0.0 | -0.017978 |       0.0 |   0.0 |   0.0 | 0.468536 | 0.125155 |
    | 01.01. |  0.0 | 28.3 | 105.5 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 |  0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.386575 |  0.407835 |  0.0 |  0.0 |  0.0 |  0.0 | -0.386575 |       0.0 |   0.0 |   0.0 |  0.0 | -0.056038 |       0.0 |   0.0 |   0.0 | 0.463874 | 0.113288 |
    | 01.01. |  0.0 | 27.8 | 248.3 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 |  0.873907 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.873907 |  0.297663 |  0.0 |  0.0 |  0.0 |  0.0 | -0.873907 |       0.0 |   0.0 |   0.0 |  0.0 | -0.161595 |       0.0 |   0.0 |   0.0 | 0.459258 | 0.082684 |
    | 01.01. |  0.0 | 31.4 | 401.3 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 |  1.463511 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.463511 |  0.108755 |  0.0 |  0.0 |  0.0 |  0.0 | -1.463511 |       0.0 |   0.0 |   0.0 |  0.0 | -0.345934 |       0.0 |   0.0 |   0.0 | 0.454688 |  0.03021 |
    | 01.01. |  0.0 | 32.2 | 449.7 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 |  1.536786 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.652872 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.652872 |       0.0 |   0.0 |   0.0 |  0.0 | -0.566251 |       0.0 |   0.0 |   0.0 | 0.450164 |      0.0 |
    | 01.01. |  0.0 | 35.2 | 493.4 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 |   1.53573 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.873973 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.873973 |       0.0 |   0.0 |   0.0 |  0.0 | -0.783929 |       0.0 |   0.0 |   0.0 | 0.445685 |      0.0 |
    | 01.01. |  0.0 | 37.1 | 261.5 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 |  0.564453 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.025236 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.025236 |       0.0 |   0.0 |   0.0 |  0.0 | -0.902033 |       0.0 |   0.0 |   0.0 |  0.44125 |      0.0 |
    | 01.01. |  0.0 | 31.2 | 363.6 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 |  0.809426 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.325006 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.325006 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.95244 |       0.0 |   0.0 |   0.0 |  0.43686 |      0.0 |
    | 01.01. |  0.0 | 24.3 | 446.2 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 |  0.877591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.479524 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.479524 |       0.0 |   0.0 |   0.0 |  0.0 | -1.034446 |       0.0 |   0.0 |   0.0 | 0.432513 |      0.0 |
    | 01.01. |  0.2 | 25.4 | 137.6 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | -0.092369 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.238302 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.238302 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.99888 |       0.0 |   0.0 |   0.0 | 0.428209 |      0.0 |
    | 01.01. |  0.0 | 25.9 | 103.0 |   0.0 | 26.7 | 0.731933 | 0.365967 |  0.0 |  0.0 | -0.083052 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.365967 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.365967 |       0.0 |   0.0 |   0.0 |  0.0 | -0.872967 |       0.0 |   0.0 |   0.0 | 0.423949 |      0.0 |
    | 01.01. |  0.0 | 23.7 |  63.7 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | -0.121034 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.227314 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.227314 |       0.0 |   0.0 |   0.0 |  0.0 | -0.768078 |       0.0 |   0.0 |   0.0 |  0.41973 |      0.0 |
    | 01.01. |  1.3 | 21.6 |  41.4 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 |  0.063243 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  1.409803 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |  1.290681 |  0.119122 |   0.0 |   0.0 |  0.0 | -0.527888 |   0.02538 |   0.0 |   0.0 | 0.415554 |      0.0 |
    | 01.01. |  5.6 | 21.2 |   7.9 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 |  0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  6.675221 |  1.330493 |  0.0 |  0.0 |  0.0 |  0.0 |  1.850192 |  4.825029 |   0.0 |   0.0 |  0.0 | -0.145837 |  1.064911 |   0.0 |   0.0 | 0.411419 | 0.369581 |
    | 01.01. |  2.9 | 20.4 |   0.0 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 |  0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.460115 |  2.499316 |  0.0 |  0.0 |  0.0 |  0.0 |  1.710992 |  1.749123 |   0.0 |   0.0 |  0.0 |  0.202945 |  1.889046 |   0.0 |   0.0 | 0.407325 | 0.694254 |
    | 01.01. |  4.9 | 19.8 |   0.0 |  5.88 | 20.6 | 0.039381 | 0.019691 |  0.0 |  0.0 |  0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  5.860309 |  3.210825 |  0.0 |  0.0 |  0.0 |  0.0 |  1.829361 |  4.030949 |   0.0 |   0.0 |  0.0 |  0.487393 |  2.320159 |   0.0 |   0.0 | 0.403272 | 0.891896 |
    | 01.01. | 10.6 | 19.6 |   0.0 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 |  0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 12.700374 |  5.569592 |  0.0 |  0.0 |  0.0 |  0.0 |  1.921262 | 10.779112 |   0.0 |   0.0 |  0.0 |  0.739258 |  4.431075 |   0.0 |   0.0 |  0.39926 | 1.547109 |
    | 01.01. |  0.1 | 19.2 |   0.0 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 |  0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.100505 |  5.810506 |  0.0 |  0.0 |  0.0 |  0.0 |  0.100505 |       0.0 |   0.0 |   0.0 |  0.0 |  0.782998 |  4.632221 |   0.0 |   0.0 | 0.395287 | 1.614029 |
    | 02.01. |  0.7 | 19.2 |   0.0 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 |  0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.820505 |  3.927652 |  0.0 |  0.0 |  0.0 |  0.0 |  0.820505 |       0.0 |   0.0 |   0.0 |  0.0 |  0.726714 |  2.809584 |   0.0 |   0.0 | 0.391354 | 1.091014 |
    | 02.01. |  3.0 | 19.2 |   0.0 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 |  0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.580505 |  3.315832 |  0.0 |  0.0 |  0.0 |  0.0 |   1.72071 |  1.859795 |   0.0 |   0.0 |  0.0 |  0.828023 |  2.100349 |   0.0 |   0.0 |  0.38746 | 0.921064 |
    | 02.01. |  2.1 | 18.9 |   0.0 |  2.52 | 19.7 | 0.038793 | 0.019396 |  0.0 |  0.0 |  0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.500604 |   3.16346 |  0.0 |  0.0 |  0.0 |  0.0 |  1.600097 |  0.900507 |   0.0 |   0.0 |  0.0 |  0.978544 |  1.801312 |   0.0 |   0.0 | 0.383605 | 0.878739 |
    | 02.01. | 10.4 | 18.7 |   0.0 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |   0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  12.46067 |  5.001808 |  0.0 |  0.0 |  0.0 |  0.0 |  1.919747 | 10.540922 |   0.0 |   0.0 |  0.0 |  1.121149 |  3.500872 |   0.0 |   0.0 | 0.379788 | 1.389391 |
    | 02.01. |  3.5 | 18.5 |   0.0 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 |  0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  4.180736 |   6.16768 |  0.0 |  0.0 |  0.0 |  0.0 |  1.760808 |  2.419928 |   0.0 |   0.0 |  0.0 |  1.251025 |  4.540646 |   0.0 |   0.0 | 0.376009 | 1.713244 |
    | 02.01. |  3.4 | 18.3 |   0.0 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 |  0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  4.060802 |  5.397199 |  0.0 |  0.0 |  0.0 |  0.0 |  1.753743 |  2.307059 |   0.0 |   0.0 |  0.0 |  1.342771 |  3.682161 |   0.0 |   0.0 | 0.372267 | 1.499222 |
    | 02.01. |  1.2 | 18.5 |   6.1 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |   0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   1.40254 |   4.41629 |  0.0 |  0.0 |  0.0 |  0.0 |  1.287008 |  0.115532 |   0.0 |   0.0 |  0.0 |  1.373556 |  2.674171 |   0.0 |   0.0 | 0.368563 | 1.226747 |
    | 02.01. |  0.1 | 18.8 |  77.9 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 |  0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.132922 |  3.232591 |  0.0 |  0.0 |  0.0 |  0.0 | -0.132922 |       0.0 |   0.0 |   0.0 |  0.0 |  1.224886 |  1.642809 |   0.0 |   0.0 | 0.364896 | 0.897942 |
    | 02.01. |  0.0 | 18.8 | 196.7 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 |  0.609108 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.609108 |   2.29184 |  0.0 |  0.0 |  0.0 |  0.0 | -0.609108 |       0.0 |   0.0 |   0.0 |  0.0 |   0.93416 |  0.996414 |   0.0 |   0.0 | 0.361265 | 0.636622 |
    | 02.01. |  0.0 | 19.0 | 121.9 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 |  0.386152 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.386152 |   1.63732 |  0.0 |  0.0 |  0.0 |  0.0 | -0.386152 |       0.0 |   0.0 |   0.0 |  0.0 |  0.675294 |  0.604356 |   0.0 |   0.0 | 0.357671 | 0.454811 |
    | 02.01. |  0.4 | 19.2 | 156.6 |  0.48 | 20.0 | 0.984401 |   0.4922 |  0.0 |  0.0 |    0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   -0.0122 |  1.238581 |  0.0 |  0.0 |  0.0 |  0.0 |   -0.0122 |       0.0 |   0.0 |   0.0 |  0.0 |  0.517909 |   0.36656 |   0.0 |   0.0 | 0.354112 |  0.34405 |
    | 02.01. |  0.1 | 19.3 | 404.7 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 |  1.243189 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.123189 |  0.890686 |  0.0 |  0.0 |  0.0 |  0.0 | -1.123189 |       0.0 |   0.0 |   0.0 |  0.0 |  0.317768 |   0.22233 |   0.0 |   0.0 | 0.350588 | 0.247413 |
    | 02.01. |  3.6 | 19.0 | 217.9 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 |  0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.645043 |  1.214269 |  0.0 |  0.0 |  0.0 |  0.0 |  1.725655 |  1.919388 |   0.0 |   0.0 |  0.0 |  0.323372 |  0.543797 |   0.0 |   0.0 |   0.3471 | 0.337297 |
    | 02.01. |  5.9 | 18.8 | 582.0 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 |  1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  5.315689 |  2.351913 |  0.0 |  0.0 |  0.0 |  0.0 |  1.811878 |  3.503811 |   0.0 |   0.0 |  0.0 |  0.585638 |   1.42263 |   0.0 |   0.0 | 0.343646 | 0.653309 |
    | 02.01. |  1.1 | 18.7 | 263.9 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 |  0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.510795 |  2.521277 |  0.0 |  0.0 |  0.0 |  0.0 |  0.510795 |       0.0 |   0.0 |   0.0 |  0.0 |  0.686066 |  1.494984 |   0.0 |   0.0 | 0.340227 | 0.700355 |
    | 02.01. | 20.7 | 17.8 | 136.8 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 |  0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 24.417849 |  6.818626 |  0.0 |  0.0 |  0.0 |  0.0 |  1.959046 | 22.458802 |   0.0 |   0.0 |  0.0 |  0.789929 |  5.691856 |   0.0 |   0.0 | 0.336841 | 1.894063 |
    | 02.01. | 37.9 | 17.4 | 146.6 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 |  0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 45.032149 |  18.01435 |  0.0 |  0.0 |  0.0 |  0.0 |  1.977794 | 43.054355 |   0.0 |   0.0 |  0.0 |   1.00361 | 16.677251 |   0.0 |   0.0 |  0.33349 | 5.003986 |
    | 02.01. |  8.2 | 17.3 | 190.6 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |   0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   9.26443 | 20.955723 |  0.0 |  0.0 |  0.0 |  0.0 |   1.89206 |   7.37237 |   0.0 |   0.0 |  0.0 |   1.17217 | 19.453382 |   0.0 |   0.0 | 0.330172 | 5.821034 |
    | 02.01. |  3.6 | 16.8 | 103.5 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |   0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   4.00171 | 15.225092 |  0.0 |  0.0 |  0.0 |  0.0 |  1.750107 |  2.251603 |   0.0 |   0.0 |  0.0 |  1.289369 | 13.608837 |   0.0 |   0.0 | 0.326886 | 4.229192 |
    | 02.01. |  7.5 | 16.5 |  13.8 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 |  0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  8.941679 | 11.872665 |  0.0 |  0.0 |  0.0 |  0.0 |  1.888164 |  7.053515 |   0.0 |   0.0 |  0.0 |  1.385817 | 10.163215 |   0.0 |   0.0 | 0.323634 | 3.297963 |
    | 02.01. | 18.5 | 16.3 |   0.0 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 |  0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 22.181476 | 13.549851 |  0.0 |  0.0 |  0.0 |  0.0 |  1.954917 | 20.226558 |   0.0 |   0.0 |  0.0 |  1.483128 | 11.746309 |   0.0 |   0.0 | 0.320413 | 3.763848 |
    | 02.01. | 15.4 | 16.2 |   0.0 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |   0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  18.46151 | 16.177406 |  0.0 |  0.0 |  0.0 |  0.0 |  1.945833 | 16.515677 |   0.0 |   0.0 |  0.0 |  1.567798 | 14.292382 |   0.0 |   0.0 | 0.317225 | 4.493724 |
    | 02.01. |  6.3 | 15.5 |   0.0 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |   0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   7.54175 |  14.80036 |  0.0 |  0.0 |  0.0 |  0.0 |  1.867405 |  5.674346 |   0.0 |   0.0 |  0.0 |  1.628979 | 12.857312 |   0.0 |   0.0 | 0.314069 | 4.111211 |
    | 02.01. |  1.9 | 14.6 |   0.0 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 |  0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.262063 | 10.926234 |  0.0 |  0.0 |  0.0 |  0.0 |  1.557926 |  0.704138 |   0.0 |   0.0 |  0.0 |  1.643215 |  8.972076 |   0.0 |   0.0 | 0.310944 | 3.035065 |
    | 03.01. |  4.9 | 14.7 |   0.0 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 |  0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  5.862028 |  8.389096 |  0.0 |  0.0 |  0.0 |  0.0 |  1.829411 |  4.032618 |   0.0 |   0.0 |  0.0 |   1.65318 |  6.428066 |   0.0 |   0.0 |  0.30785 | 2.330304 |
    | 03.01. |  2.7 | 14.6 |   0.0 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 |  0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.222063 |  6.929658 |  0.0 |  0.0 |  0.0 |  0.0 |   1.68964 |  1.532423 |   0.0 |   0.0 |  0.0 |  1.672035 |  4.952836 |   0.0 |   0.0 | 0.304787 | 1.924905 |
    | 03.01. |  0.5 | 14.1 |   0.0 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 |  0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.582239 |  5.153776 |  0.0 |  0.0 |  0.0 |  0.0 |  0.582239 |       0.0 |   0.0 |   0.0 |  0.0 |  1.571514 |  3.280508 |   0.0 |   0.0 | 0.301754 | 1.431605 |
    | 03.01. |  0.2 | 14.3 |   0.0 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 |  0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.222169 |  3.646947 |  0.0 |  0.0 |  0.0 |  0.0 |  0.222169 |       0.0 |   0.0 |   0.0 |  0.0 |  1.358467 |  1.989729 |   0.0 |   0.0 | 0.298752 | 1.013041 |
    | 03.01. |  0.5 | 14.9 |   0.0 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 |  0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.581959 |  2.688797 |  0.0 |  0.0 |  0.0 |  0.0 |  0.581959 |       0.0 |   0.0 |   0.0 |  0.0 |  1.186187 |  1.206832 |   0.0 |   0.0 | 0.295779 | 0.746888 |
    | 03.01. |  2.4 | 15.7 |   0.0 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 |  0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.861681 |  2.459597 |  0.0 |  0.0 |  0.0 |  0.0 |  1.650555 |  1.211126 |   0.0 |   0.0 |  0.0 |  1.176737 |  0.990025 |   0.0 |   0.0 | 0.292836 | 0.683221 |
    | 03.01. |  0.4 | 16.0 |   4.4 |  0.48 | 16.8 | 0.061945 | 0.030972 |  0.0 |  0.0 |  0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.449028 |  2.258997 |  0.0 |  0.0 |  0.0 |  0.0 |  0.449028 |       0.0 |   0.0 |   0.0 |  0.0 |  1.150098 |  0.818977 |   0.0 |   0.0 | 0.289922 | 0.627499 |
    | 03.01. |  0.2 | 16.7 |  26.1 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 |  0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.145926 |  1.778401 |  0.0 |  0.0 |  0.0 |  0.0 |  0.145926 |       0.0 |   0.0 |   0.0 |  0.0 |  0.994629 |  0.496735 |   0.0 |   0.0 | 0.287037 |    0.494 |
    | 03.01. |  0.0 | 17.1 |  74.2 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 |  0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.234745 |    1.3906 |  0.0 |  0.0 |  0.0 |  0.0 | -0.234745 |       0.0 |   0.0 |   0.0 |  0.0 |  0.805134 |  0.301285 |   0.0 |   0.0 | 0.284181 | 0.386278 |
    | 03.01. |  0.0 | 16.2 | 287.1 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 |  0.840459 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.840459 |     1.024 |  0.0 |  0.0 |  0.0 |  0.0 | -0.840459 |       0.0 |   0.0 |   0.0 |  0.0 |  0.559908 |  0.182738 |   0.0 |   0.0 | 0.281354 | 0.284445 |
    | 03.01. |  0.3 | 15.9 | 299.8 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 |  0.871943 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.511943 |  0.726222 |  0.0 |  0.0 |  0.0 |  0.0 | -0.511943 |       0.0 |   0.0 |   0.0 |  0.0 |  0.336832 |  0.110837 |   0.0 |   0.0 | 0.278554 | 0.201728 |
    | 03.01. |  2.6 | 16.3 | 363.5 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 |  1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.058849 |  0.831772 |  0.0 |  0.0 |  0.0 |  0.0 |  1.514292 |  0.544558 |   0.0 |   0.0 |  0.0 |  0.372739 |   0.18325 |   0.0 |   0.0 | 0.275782 | 0.231048 |
    | 03.01. |  0.7 | 16.3 | 368.4 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 |  1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.235205 |  0.898248 |  0.0 |  0.0 |  0.0 |  0.0 | -0.235205 |       0.0 |   0.0 |   0.0 |  0.0 |  0.415821 |  0.209389 |   0.0 |   0.0 | 0.273038 | 0.249513 |
    | 03.01. |  0.3 | 16.4 | 317.8 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 |  0.931783 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.571783 |  0.663611 |  0.0 |  0.0 |  0.0 |  0.0 | -0.571783 |       0.0 |   0.0 |   0.0 |  0.0 |  0.266288 |  0.127001 |   0.0 |   0.0 | 0.270322 | 0.184336 |
    | 03.01. |  0.3 | 16.5 | 534.7 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 |  1.557919 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.197919 |  0.400393 |  0.0 |  0.0 |  0.0 |  0.0 | -1.197919 |       0.0 |   0.0 |   0.0 |  0.0 |  0.055731 |   0.07703 |   0.0 |   0.0 | 0.267632 |  0.11122 |
    | 03.01. |  0.0 | 18.4 | 319.4 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 |  0.970313 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.970313 |  0.161489 |  0.0 |  0.0 |  0.0 |  0.0 | -0.970313 |       0.0 |   0.0 |   0.0 |  0.0 | -0.150201 |  0.046721 |   0.0 |   0.0 | 0.264969 | 0.044858 |
    | 03.01. |  0.0 | 18.3 | 350.6 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 |  1.044663 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.061384 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.061384 |       0.0 |   0.0 |   0.0 |  0.0 | -0.307391 |  0.028338 |   0.0 |   0.0 | 0.262332 |      0.0 |
    | 03.01. |  0.0 | 18.1 | 215.4 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 |  0.527903 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.657207 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.657207 |       0.0 |   0.0 |   0.0 |  0.0 | -0.406214 |  0.017188 |   0.0 |   0.0 | 0.259722 |      0.0 |
    | 03.01. |  0.0 | 16.7 |  97.8 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 |  0.150432 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.301243 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.301243 |       0.0 |   0.0 |   0.0 |  0.0 | -0.418374 |  0.010425 |   0.0 |   0.0 | 0.257138 |      0.0 |
    | 03.01. |  0.0 | 15.2 |  13.1 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | -0.058221 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.054952 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.054952 |       0.0 |   0.0 |   0.0 |  0.0 | -0.374076 |  0.006323 |   0.0 |   0.0 | 0.254579 |      0.0 |
    | 03.01. |  0.0 | 13.4 |   0.0 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | -0.039328 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017513 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017513 |       0.0 |   0.0 |   0.0 |  0.0 | -0.312722 |  0.003835 |   0.0 |   0.0 | 0.252046 |      0.0 |
    | 03.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 |  0.009842 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017154 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017154 |       0.0 |   0.0 |   0.0 |  0.0 | -0.259176 |  0.002326 |   0.0 |   0.0 | 0.249538 |      0.0 |
    | 03.01. |  0.0 | 11.6 |   0.0 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 |  0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016863 |  0.033188 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016863 |       0.0 |   0.0 |   0.0 |  0.0 | -0.215278 |  0.001411 |   0.0 |   0.0 | 0.247055 | 0.009219 |
    | 03.01. |  0.0 | 11.0 |   0.0 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 |  0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016643 |  0.066162 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016643 |       0.0 |   0.0 |   0.0 |  0.0 | -0.179291 |  0.000856 |   0.0 |   0.0 | 0.244597 | 0.018378 |
    | 04.01. |  0.0 | 10.5 |   0.0 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 |  0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016458 |  0.092892 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016458 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.14979 |  0.000519 |   0.0 |   0.0 | 0.242163 | 0.025803 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |    0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   -0.0169 |  0.114406 |  0.0 |  0.0 |  0.0 |  0.0 |   -0.0169 |       0.0 |   0.0 |   0.0 |  0.0 | -0.125663 |  0.000315 |   0.0 |   0.0 | 0.239754 | 0.031779 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 |  0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016973 |  0.131605 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016973 |       0.0 |   0.0 |   0.0 |  0.0 | -0.105954 |  0.000191 |   0.0 |   0.0 | 0.237368 | 0.036557 |
    | 04.01. |  1.3 | 11.2 |   0.0 |  1.56 | 12.0 | 0.033433 | 0.016717 |  0.0 |  0.0 |  0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  1.543283 |  0.314258 |  0.0 |  0.0 |  0.0 |  0.0 |  1.352031 |  0.191252 |   0.0 |   0.0 |  0.0 |  0.038388 |  0.040864 |   0.0 |   0.0 | 0.235006 | 0.087294 |
    | 04.01. |  0.0 | 11.1 |   0.0 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |   0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.01668 |  0.440283 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.01668 |       0.0 |   0.0 |   0.0 |  0.0 |  0.148326 |  0.059289 |   0.0 |   0.0 | 0.232668 | 0.122301 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 |  0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016973 |  0.384701 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016973 |       0.0 |   0.0 |   0.0 |  0.0 |  0.118388 |  0.035961 |   0.0 |   0.0 | 0.230353 | 0.106861 |
    | 04.01. |  0.0 | 12.2 |  17.0 |   0.0 | 13.0 | 0.124091 | 0.062046 |  0.0 |  0.0 |  0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.062046 |  0.339502 |  0.0 |  0.0 |  0.0 |  0.0 | -0.062046 |       0.0 |   0.0 |   0.0 |  0.0 |   0.08963 |  0.021811 |   0.0 |   0.0 | 0.228061 | 0.094306 |
    | 04.01. |  0.7 | 11.8 |  99.7 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 |  0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.561608 |  0.359564 |  0.0 |  0.0 |  0.0 |  0.0 |  0.561608 |       0.0 |   0.0 |   0.0 |  0.0 |  0.120543 |  0.013229 |   0.0 |   0.0 | 0.225792 | 0.099879 |
    | 04.01. |  0.4 | 11.4 | 239.4 |  0.48 | 12.2 | 1.278351 | 0.639175 |  0.0 |  0.0 |  0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.159175 |   0.36456 |  0.0 |  0.0 |  0.0 |  0.0 | -0.159175 |       0.0 |   0.0 |   0.0 |  0.0 |  0.132991 |  0.008024 |   0.0 |   0.0 | 0.223545 | 0.101267 |
    | 04.01. |  0.1 | 11.6 | 391.2 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 |   1.03833 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.91833 |   0.23512 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.91833 |       0.0 |   0.0 |   0.0 |  0.0 |  0.008932 |  0.004867 |   0.0 |   0.0 | 0.221321 | 0.065311 |
    | 04.01. |  0.4 | 13.0 | 525.6 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 |  1.431007 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.951007 |  0.059858 |  0.0 |  0.0 |  0.0 |  0.0 | -0.951007 |       0.0 |   0.0 |   0.0 |  0.0 | -0.162212 |  0.002952 |   0.0 |   0.0 | 0.219118 | 0.016627 |
    | 04.01. |  0.0 | 17.1 | 570.2 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 |  1.523706 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.678286 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.678286 |       0.0 |   0.0 |   0.0 |  0.0 | -0.373309 |   0.00179 |   0.0 |   0.0 | 0.216938 |      0.0 |
    | 04.01. |  0.0 | 18.2 | 559.1 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 |  1.284264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.678257 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.678257 |       0.0 |   0.0 |   0.0 |  0.0 | -0.609858 |  0.001086 |   0.0 |   0.0 |  0.21478 |      0.0 |
    | 04.01. |  0.0 | 22.4 | 668.0 |   0.0 | 23.2 | 4.286095 | 2.143047 |  0.0 |  0.0 |  1.509293 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -2.143047 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -2.143047 |       0.0 |   0.0 |   0.0 |  0.0 | -0.847056 |  0.000659 |   0.0 |   0.0 | 0.212642 |      0.0 |
    | 04.01. |  0.0 | 21.4 | 593.4 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 |  1.030572 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.876679 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.876679 |       0.0 |   0.0 |   0.0 |  0.0 | -1.057033 |  0.000399 |   0.0 |   0.0 | 0.210527 |      0.0 |
    | 04.01. |  0.0 | 21.8 | 493.0 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 |  0.603946 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.572383 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.572383 |       0.0 |   0.0 |   0.0 |  0.0 | -1.177111 |  0.000242 |   0.0 |   0.0 | 0.208432 |      0.0 |
    | 04.01. |  0.0 | 22.2 | 391.2 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 |  0.246696 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.259666 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.259666 |       0.0 |   0.0 |   0.0 |  0.0 | -1.219474 |  0.000147 |   0.0 |   0.0 | 0.206358 |      0.0 |
    | 04.01. |  0.0 | 20.1 | 186.0 |   0.0 | 20.9 | 1.179367 | 0.589683 |  0.0 |  0.0 | -0.369936 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.589683 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.589683 |       0.0 |   0.0 |   0.0 |  0.0 | -1.164013 |  0.000089 |   0.0 |   0.0 | 0.204305 |      0.0 |
    | 04.01. |  0.0 | 17.8 |  82.4 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 |  -0.56503 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.261846 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.261846 |       0.0 |   0.0 |   0.0 |  0.0 | -1.029202 |  0.000054 |   0.0 |   0.0 | 0.202272 |      0.0 |
    | 04.01. |  0.0 | 15.2 |  17.0 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 | -0.605552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.06591 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.06591 |       0.0 |   0.0 |   0.0 |  0.0 | -0.871754 |  0.000033 |   0.0 |   0.0 | 0.200259 |      0.0 |
    | 04.01. |  0.0 | 14.5 |   0.0 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | -0.504995 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017902 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017902 |       0.0 |   0.0 |   0.0 |  0.0 | -0.721183 |   0.00002 |   0.0 |   0.0 | 0.198267 |      0.0 |
    | 04.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 |  -0.38017 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017154 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017154 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.59363 |  0.000012 |   0.0 |   0.0 | 0.196294 |      0.0 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 | -0.277861 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   -0.0169 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   -0.0169 |       0.0 |   0.0 |   0.0 |  0.0 | -0.489109 |  0.000007 |   0.0 |   0.0 | 0.194341 |      0.0 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | -0.194134 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016973 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016973 |       0.0 |   0.0 |   0.0 |  0.0 | -0.403519 |  0.000004 |   0.0 |   0.0 | 0.192407 |      0.0 |

    .. raw:: html

        <iframe
            src="lland_v1_ex4.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    .. _lland_v1_ex5:

    **Example 5**

    For sealed surfaces, retention processes below the surface are assumed
    to be negligible.  All water reaching the sealed surface becomes direct
    discharge immediately:

    >>> lnk(VERS)
    >>> test('lland_v1_ex5')
    |   date | nied | teml |  glob |  nkor | tkor |      et0 |     evpo |      nbes | sbes |      evi | evb |      wgtf | schm |      wada |       qdb | qib1 | qib2 | qbb |      qdgz |         q |     inzp | wats | waes | bowa |    qdgz1 |     qdgz2 | qigz1 | qigz2 | qbgz |    qdga1 |     qdga2 | qiga1 | qiga2 |     qbga |   outlet |
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |   0.0 |   0.0 | 22.0 | 0.040283 | 0.020141 |       0.0 |  0.0 |      0.0 | 0.0 | 11.275777 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.497508 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.497508 | 0.138197 |
    | 01.01. |  0.0 | 19.4 |   0.0 |   0.0 | 20.2 | 0.039121 |  0.01956 |       0.0 |  0.0 |      0.0 | 0.0 | 10.353214 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.492558 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.492558 | 0.136822 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.0 | 10.096946 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.487657 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.487657 |  0.13546 |
    | 01.01. |  0.0 | 18.3 |   0.0 |   0.0 | 19.1 | 0.038396 | 0.019198 |       0.0 |  0.0 |      0.0 | 0.0 |  9.789425 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.482805 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.482805 | 0.134112 |
    | 01.01. |  0.0 | 18.9 |   0.0 |   0.0 | 19.7 | 0.038793 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.0 | 10.096946 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.478001 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.478001 | 0.132778 |
    | 01.01. |  0.0 | 22.5 |   0.0 |   0.0 | 23.3 | 0.041105 | 0.020552 |       0.0 |  0.0 |      0.0 | 0.0 | 11.942073 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.473245 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.473245 | 0.131457 |
    | 01.01. |  0.0 | 25.1 |  11.2 |   0.0 | 25.9 | 0.116763 | 0.058382 |       0.0 |  0.0 |      0.0 | 0.0 | 13.274665 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.468536 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.468536 | 0.130149 |
    | 01.01. |  0.0 | 28.3 | 105.5 |   0.0 | 29.1 |  0.77315 | 0.386575 |       0.0 |  0.0 |      0.0 | 0.0 | 14.914778 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.463874 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.463874 | 0.128854 |
    | 01.01. |  0.0 | 27.8 | 248.3 |   0.0 | 28.6 | 1.747814 | 0.873907 |       0.0 |  0.0 |      0.0 | 0.0 |  14.65851 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.459258 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.459258 | 0.127572 |
    | 01.01. |  0.0 | 31.4 | 401.3 |   0.0 | 32.2 | 2.927022 | 1.463511 |       0.0 |  0.0 |      0.0 | 0.0 | 16.503638 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.454688 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.454688 | 0.126302 |
    | 01.01. |  0.0 | 32.2 | 449.7 |   0.0 | 33.0 | 3.305745 | 1.652872 |       0.0 |  0.0 |      0.0 | 0.0 | 16.913666 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.450164 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.450164 | 0.125046 |
    | 01.01. |  0.0 | 35.2 | 493.4 |   0.0 | 36.0 | 3.747947 | 1.873973 |       0.0 |  0.0 |      0.0 | 0.0 | 18.451272 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.445685 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.445685 | 0.123801 |
    | 01.01. |  0.0 | 37.1 | 261.5 |   0.0 | 37.9 | 2.050471 | 1.025236 |       0.0 |  0.0 |      0.0 | 0.0 | 19.425089 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.44125 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.44125 |  0.12257 |
    | 01.01. |  0.0 | 31.2 | 363.6 |   0.0 | 32.0 | 2.650012 | 1.325006 |       0.0 |  0.0 |      0.0 | 0.0 | 16.401131 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.43686 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.43686 |  0.12135 |
    | 01.01. |  0.0 | 24.3 | 446.2 |   0.0 | 25.1 | 2.959048 | 1.479524 |       0.0 |  0.0 |      0.0 | 0.0 | 12.864637 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.432513 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.432513 | 0.120142 |
    | 01.01. |  0.2 | 25.4 | 137.6 |  0.24 | 26.2 | 0.956604 | 0.478302 |       0.0 |  0.0 |     0.24 | 0.0 | 13.428426 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.428209 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.428209 | 0.118947 |
    | 01.01. |  0.0 | 25.9 | 103.0 |   0.0 | 26.7 | 0.731933 | 0.365967 |       0.0 |  0.0 |      0.0 | 0.0 | 13.684693 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.423949 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.423949 | 0.117764 |
    | 01.01. |  0.0 | 23.7 |  63.7 |   0.0 | 24.5 | 0.454628 | 0.227314 |       0.0 |  0.0 |      0.0 | 0.0 | 12.557116 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.41973 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.41973 | 0.116592 |
    | 01.01. |  1.3 | 21.6 |  41.4 |  1.56 | 22.4 | 0.300394 | 0.150197 |      0.76 |  0.0 | 0.150197 | 0.0 | 11.480791 |  0.0 |      0.76 |      0.76 |  0.0 |  0.0 | 0.0 |      0.76 |  0.486731 | 0.649803 |  0.0 |  0.0 |  0.0 |     0.76 |       0.0 |   0.0 |   0.0 |  0.0 | 0.071177 |       0.0 |   0.0 |   0.0 | 0.415554 | 0.135203 |
    | 01.01. |  5.6 | 21.2 |   7.9 |  6.72 | 22.0 | 0.089558 | 0.044779 |  6.569803 |  0.0 | 0.044779 | 0.0 | 11.275777 |  0.0 |  6.569803 |  6.569803 |  0.0 |  0.0 | 0.0 |  6.569803 |  1.715412 | 0.755221 |  0.0 |  0.0 |  0.0 | 1.847788 |  4.722014 |   0.0 |   0.0 |  0.0 | 0.297915 |  1.006079 |   0.0 |   0.0 | 0.411419 | 0.476503 |
    | 01.01. |  2.9 | 20.4 |   0.0 |  3.48 | 21.2 |  0.03977 | 0.019885 |  3.435221 |  0.0 | 0.019885 | 0.0 | 10.865749 |  0.0 |  3.435221 |  3.435221 |  0.0 |  0.0 | 0.0 |  3.435221 |  2.803096 | 0.780115 |  0.0 |  0.0 |  0.0 | 1.708898 |  1.726323 |   0.0 |   0.0 |  0.0 | 0.565852 |  1.829919 |   0.0 |   0.0 | 0.407325 | 0.778638 |
    | 01.01. |  4.9 | 19.8 |   0.0 |  5.88 | 20.6 | 0.039381 | 0.019691 |  5.860115 |  0.0 | 0.019691 | 0.0 | 10.558228 |  0.0 |  5.860115 |  5.860115 |  0.0 |  0.0 | 0.0 |  5.860115 |  3.467748 | 0.780309 |  0.0 |  0.0 |  0.0 | 1.829355 |   4.03076 |   0.0 |   0.0 |  0.0 | 0.784332 |  2.280144 |   0.0 |   0.0 | 0.403272 | 0.963263 |
    | 01.01. | 10.6 | 19.6 |   0.0 | 12.72 | 20.4 | 0.039251 | 0.019626 | 12.700309 |  0.0 | 0.019626 | 0.0 | 10.455721 |  0.0 | 12.700309 | 12.700309 |  0.0 |  0.0 | 0.0 | 12.700309 |  5.788386 | 0.780374 |  0.0 |  0.0 |  0.0 | 1.921262 | 10.779048 |   0.0 |   0.0 |  0.0 |  0.98237 |  4.406757 |   0.0 |   0.0 |  0.39926 | 1.607885 |
    | 01.01. |  0.1 | 19.2 |   0.0 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.100374 |  0.0 | 0.019495 | 0.0 | 10.250707 |  0.0 |  0.100374 |  0.100374 |  0.0 |  0.0 | 0.0 |  0.100374 |  5.994776 | 0.780505 |  0.0 |  0.0 |  0.0 | 0.100374 |       0.0 |   0.0 |   0.0 |  0.0 | 0.982029 |   4.61746 |   0.0 |   0.0 | 0.395287 | 1.665216 |
    | 02.01. |  0.7 | 19.2 |   0.0 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.820505 |  0.0 | 0.019495 | 0.0 | 10.250707 |  0.0 |  0.820505 |  0.820505 |  0.0 |  0.0 | 0.0 |  0.820505 |   4.08164 | 0.780505 |  0.0 |  0.0 |  0.0 | 0.820505 |       0.0 |   0.0 |   0.0 |  0.0 | 0.889655 |  2.800631 |   0.0 |   0.0 | 0.391354 | 1.133789 |
    | 02.01. |  3.0 | 19.2 |   0.0 |   3.6 | 20.0 |  0.03899 | 0.019495 |  3.580505 |  0.0 | 0.019495 | 0.0 | 10.250707 |  0.0 |  3.580505 |  3.580505 |  0.0 |  0.0 | 0.0 |  3.580505 |  3.443807 | 0.780505 |  0.0 |  0.0 |  0.0 |  1.72071 |  1.859795 |   0.0 |   0.0 |  0.0 | 0.961428 |  2.094919 |   0.0 |   0.0 |  0.38746 | 0.956613 |
    | 02.01. |  2.1 | 18.9 |   0.0 |  2.52 | 19.7 | 0.038793 | 0.019396 |  2.500505 |  0.0 | 0.019396 | 0.0 | 10.096946 |  0.0 |  2.500505 |  2.500505 |  0.0 |  0.0 | 0.0 |  2.500505 |   3.26937 | 0.780604 |  0.0 |  0.0 |  0.0 | 1.600081 |  0.900424 |   0.0 |   0.0 |  0.0 | 1.087765 |     1.798 |   0.0 |   0.0 | 0.383605 | 0.908158 |
    | 02.01. | 10.4 | 18.7 |   0.0 | 12.48 | 19.5 | 0.038661 |  0.01933 | 12.460604 |  0.0 |  0.01933 | 0.0 |  9.994439 |  0.0 | 12.460604 | 12.460604 |  0.0 |  0.0 | 0.0 | 12.460604 |  5.089193 |  0.78067 |  0.0 |  0.0 |  0.0 | 1.919747 | 10.540857 |   0.0 |   0.0 |  0.0 |  1.21057 |  3.498835 |   0.0 |   0.0 | 0.379788 | 1.413665 |
    | 02.01. |  3.5 | 18.5 |   0.0 |   4.2 | 19.3 | 0.038528 | 0.019264 |   4.18067 |  0.0 | 0.019264 | 0.0 |  9.891932 |  0.0 |   4.18067 |   4.18067 |  0.0 |  0.0 | 0.0 |   4.18067 |  6.239631 | 0.780736 |  0.0 |  0.0 |  0.0 | 1.760804 |  2.419866 |   0.0 |   0.0 |  0.0 | 1.324236 |  4.539385 |   0.0 |   0.0 | 0.376009 | 1.733231 |
    | 02.01. |  3.4 | 18.3 |   0.0 |  4.08 | 19.1 | 0.038396 | 0.019198 |  4.060736 |  0.0 | 0.019198 | 0.0 |  9.789425 |  0.0 |  4.060736 |  4.060736 |  0.0 |  0.0 | 0.0 |  4.060736 |   5.45635 | 0.780802 |  0.0 |  0.0 |  0.0 | 1.753739 |  2.306997 |   0.0 |   0.0 |  0.0 | 1.402711 |  3.681371 |   0.0 |   0.0 | 0.372267 | 1.515653 |
    | 02.01. |  1.2 | 18.5 |   6.1 |  1.44 | 19.3 | 0.074919 |  0.03746 |  1.420802 |  0.0 |  0.03746 | 0.0 |  9.891932 |  0.0 |  1.420802 |  1.420802 |  0.0 |  0.0 | 0.0 |  1.420802 |  4.467671 |  0.76254 |  0.0 |  0.0 |  0.0 | 1.296172 |   0.12463 |   0.0 |   0.0 |  0.0 | 1.423489 |  2.675619 |   0.0 |   0.0 | 0.368563 |  1.24102 |
    | 02.01. |  0.1 | 18.8 |  77.9 |  0.12 | 19.6 | 0.505845 | 0.252922 |   0.08254 |  0.0 | 0.252922 | 0.0 | 10.045692 |  0.0 |   0.08254 |   0.08254 |  0.0 |  0.0 | 0.0 |   0.08254 |  3.296974 | 0.547078 |  0.0 |  0.0 |  0.0 |  0.08254 |       0.0 |   0.0 |   0.0 |  0.0 | 1.286749 |  1.645329 |   0.0 |   0.0 | 0.364896 | 0.915826 |
    | 02.01. |  0.0 | 18.8 | 196.7 |   0.0 | 19.6 | 1.218215 | 0.609108 |       0.0 |  0.0 | 0.547078 | 0.0 | 10.045692 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  2.419941 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 1.060733 |  0.997943 |   0.0 |   0.0 | 0.361265 | 0.672206 |
    | 02.01. |  0.0 | 19.0 | 121.9 |   0.0 | 19.8 | 0.772303 | 0.386152 |       0.0 |  0.0 |      0.0 | 0.0 |   10.1482 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.831408 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.868455 |  0.605283 |   0.0 |   0.0 | 0.357671 | 0.508724 |
    | 02.01. |  0.4 | 19.2 | 156.6 |  0.48 | 20.0 | 0.984401 |   0.4922 |       0.0 |  0.0 |     0.48 | 0.0 | 10.250707 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.432265 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |  0.71103 |  0.367123 |   0.0 |   0.0 | 0.354112 | 0.397851 |
    | 02.01. |  0.1 | 19.3 | 404.7 |  0.12 | 20.1 | 2.486378 | 1.243189 |       0.0 |  0.0 |     0.12 | 0.0 |  10.30196 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.155402 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.582143 |  0.222671 |   0.0 |   0.0 | 0.350588 | 0.320945 |
    | 02.01. |  3.6 | 19.0 | 217.9 |  4.32 | 19.8 | 1.349913 | 0.674957 |      3.52 |  0.0 | 0.674957 | 0.0 |   10.1482 |  0.0 |      3.52 |      3.52 |  0.0 |  0.0 | 0.0 |      3.52 |  1.503858 | 0.125043 |  0.0 |  0.0 |  0.0 | 1.715909 |  1.804091 |   0.0 |   0.0 |  0.0 | 0.637319 |  0.519439 |   0.0 |   0.0 |   0.3471 | 0.417738 |
    | 02.01. |  5.9 | 18.8 | 582.0 |  7.08 | 19.6 | 3.528622 | 1.764311 |  6.405043 |  0.0 |      0.8 | 0.0 | 10.045692 |  0.0 |  6.405043 |  6.405043 |  0.0 |  0.0 | 0.0 |  6.405043 |  2.800802 |      0.0 |  0.0 |  0.0 |  0.0 | 1.843873 |   4.56117 |   0.0 |   0.0 |  0.0 | 0.844819 |  1.612337 |   0.0 |   0.0 | 0.343646 | 0.778001 |
    | 02.01. |  1.1 | 18.7 | 263.9 |  1.32 | 19.5 |  1.61841 | 0.809205 |      0.52 |  0.0 |      0.8 | 0.0 |  9.994439 |  0.0 |      0.52 |      0.52 |  0.0 |  0.0 | 0.0 |      0.52 |  3.042961 |      0.0 |  0.0 |  0.0 |  0.0 |     0.52 |       0.0 |   0.0 |   0.0 |  0.0 | 0.901931 |  1.800804 |   0.0 |   0.0 | 0.340227 | 0.845267 |
    | 02.01. | 20.7 | 17.8 | 136.8 | 24.84 | 18.6 | 0.844303 | 0.422151 |     24.04 |  0.0 | 0.422151 | 0.0 |  9.533157 |  0.0 |     24.04 |     24.04 |  0.0 |  0.0 | 0.0 |     24.04 |  7.101229 | 0.377849 |  0.0 |  0.0 |  0.0 | 1.958403 | 22.081597 |   0.0 |   0.0 |  0.0 |  0.96741 |  5.796977 |   0.0 |   0.0 | 0.336841 | 1.972564 |
    | 02.01. | 37.9 | 17.4 | 146.6 | 45.48 | 18.2 | 0.895703 | 0.447851 | 45.057849 |  0.0 | 0.447851 | 0.0 |  9.328143 |  0.0 | 45.057849 | 45.057849 |  0.0 |  0.0 | 0.0 | 45.057849 | 18.160786 | 0.352149 |  0.0 |  0.0 |  0.0 | 1.977806 | 43.080042 |   0.0 |   0.0 |  0.0 | 1.148864 | 16.678432 |   0.0 |   0.0 |  0.33349 | 5.044663 |
    | 02.01. |  8.2 | 17.3 | 190.6 |  9.84 | 18.1 | 1.151139 |  0.57557 |  9.392149 |  0.0 |  0.57557 | 0.0 |  9.276889 |  0.0 |  9.392149 |  9.392149 |  0.0 |  0.0 | 0.0 |  9.392149 | 21.107036 |  0.22443 |  0.0 |  0.0 |  0.0 | 1.893528 |   7.49862 |   0.0 |   0.0 |  0.0 | 1.291233 | 19.485632 |   0.0 |   0.0 | 0.330172 | 5.863066 |
    | 02.01. |  3.6 | 16.8 | 103.5 |  4.32 | 17.6 | 0.636581 |  0.31829 |   3.74443 |  0.0 |  0.31829 | 0.0 |  9.020622 |  0.0 |   3.74443 |   3.74443 |  0.0 |  0.0 | 0.0 |   3.74443 | 15.312272 |  0.48171 |  0.0 |  0.0 |  0.0 | 1.732937 |  2.011494 |   0.0 |   0.0 |  0.0 |  1.38537 | 13.600016 |   0.0 |   0.0 | 0.326886 | 4.253409 |
    | 02.01. |  7.5 | 16.5 |  13.8 |   9.0 | 17.3 | 0.116642 | 0.058321 |   8.68171 |  0.0 | 0.058321 | 0.0 |  8.866861 |  0.0 |   8.68171 |   8.68171 |  0.0 |  0.0 | 0.0 |   8.68171 | 11.846103 | 0.741679 |  0.0 |  0.0 |  0.0 | 1.884815 |  6.796894 |   0.0 |   0.0 |  0.0 | 1.462598 | 10.059871 |   0.0 |   0.0 | 0.323634 | 3.290584 |
    | 02.01. | 18.5 | 16.3 |   0.0 |  22.2 | 17.1 | 0.037049 | 0.018524 | 22.141679 |  0.0 | 0.018524 | 0.0 |  8.764354 |  0.0 | 22.141679 | 22.141679 |  0.0 |  0.0 | 0.0 | 22.141679 | 13.494974 | 0.781476 |  0.0 |  0.0 |  0.0 | 1.954836 | 20.186843 |   0.0 |   0.0 |  0.0 |  1.54569 |  11.62887 |   0.0 |   0.0 | 0.320413 | 3.748604 |
    | 02.01. | 15.4 | 16.2 |   0.0 | 18.48 | 17.0 |  0.03698 |  0.01849 | 18.461476 |  0.0 |  0.01849 | 0.0 |  8.713101 |  0.0 | 18.461476 | 18.461476 |  0.0 |  0.0 | 0.0 | 18.461476 | 16.150217 |  0.78151 |  0.0 |  0.0 |  0.0 | 1.945833 | 16.515642 |   0.0 |   0.0 |  0.0 | 1.619013 | 14.213979 |   0.0 |   0.0 | 0.317225 | 4.486171 |
    | 02.01. |  6.3 | 15.5 |   0.0 |  7.56 | 16.3 | 0.036499 |  0.01825 |   7.54151 |  0.0 |  0.01825 | 0.0 |  8.354326 |  0.0 |   7.54151 |   7.54151 |  0.0 |  0.0 | 0.0 |   7.54151 |  14.79468 |  0.78175 |  0.0 |  0.0 |  0.0 | 1.867401 |  5.674109 |   0.0 |   0.0 |  0.0 |  1.67091 | 12.809702 |   0.0 |   0.0 | 0.314069 | 4.109633 |
    | 02.01. |  1.9 | 14.6 |   0.0 |  2.28 | 15.4 | 0.035873 | 0.017937 |   2.26175 |  0.0 | 0.017937 | 0.0 |  7.893044 |  0.0 |   2.26175 |   2.26175 |  0.0 |  0.0 | 0.0 |   2.26175 | 10.931585 | 0.782063 |  0.0 |  0.0 |  0.0 | 1.557865 |  0.703886 |   0.0 |   0.0 |  0.0 | 1.677538 |  8.943102 |   0.0 |   0.0 | 0.310944 | 3.036551 |
    | 03.01. |  4.9 | 14.7 |   0.0 |  5.88 | 15.5 | 0.035943 | 0.017972 |  5.862063 |  0.0 | 0.017972 | 0.0 |  7.944298 |  0.0 |  5.862063 |  5.862063 |  0.0 |  0.0 | 0.0 |  5.862063 |  8.399581 | 0.782028 |  0.0 |  0.0 |  0.0 | 1.829412 |  4.032652 |   0.0 |   0.0 |  0.0 | 1.681277 |  6.410455 |   0.0 |   0.0 |  0.30785 | 2.333217 |
    | 03.01. |  2.7 | 14.6 |   0.0 |  3.24 | 15.4 | 0.035873 | 0.017937 |  3.222028 |  0.0 | 0.017937 | 0.0 |  7.893044 |  0.0 |  3.222028 |  3.222028 |  0.0 |  0.0 | 0.0 |  3.222028 |  6.941979 | 0.782063 |  0.0 |  0.0 |  0.0 | 1.689637 |  1.532392 |   0.0 |   0.0 |  0.0 | 1.695038 |  4.942153 |   0.0 |   0.0 | 0.304787 | 1.928327 |
    | 03.01. |  0.5 | 14.1 |   0.0 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.582063 |  0.0 | 0.017761 | 0.0 |  7.636776 |  0.0 |  0.582063 |  0.582063 |  0.0 |  0.0 | 0.0 |  0.582063 |  5.166108 | 0.782239 |  0.0 |  0.0 |  0.0 | 0.582063 |       0.0 |   0.0 |   0.0 |  0.0 | 1.590331 |  3.274023 |   0.0 |   0.0 | 0.301754 |  1.43503 |
    | 03.01. |  0.2 | 14.3 |   0.0 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.222239 |  0.0 | 0.017831 | 0.0 |  7.739283 |  0.0 |  0.222239 |  0.222239 |  0.0 |  0.0 | 0.0 |  0.222239 |  3.658411 | 0.782169 |  0.0 |  0.0 |  0.0 | 0.222239 |       0.0 |   0.0 |   0.0 |  0.0 | 1.373864 |  1.985796 |   0.0 |   0.0 | 0.298752 | 1.016225 |
    | 03.01. |  0.5 | 14.9 |   0.0 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.582169 |  0.0 | 0.018041 | 0.0 |  8.046805 |  0.0 |  0.582169 |  0.582169 |  0.0 |  0.0 | 0.0 |  0.582169 |  2.699043 | 0.781959 |  0.0 |  0.0 |  0.0 | 0.582169 |       0.0 |   0.0 |   0.0 |  0.0 | 1.198819 |  1.204446 |   0.0 |   0.0 | 0.295779 | 0.749734 |
    | 03.01. |  2.4 | 15.7 |   0.0 |  2.88 | 16.5 | 0.036637 | 0.018319 |  2.861959 |  0.0 | 0.018319 | 0.0 |  8.456833 |  0.0 |  2.861959 |  2.861959 |  0.0 |  0.0 | 0.0 |  2.861959 |  2.468566 | 0.781681 |  0.0 |  0.0 |  0.0 | 1.650589 |   1.21137 |   0.0 |   0.0 |  0.0 |   1.1871 |  0.988629 |   0.0 |   0.0 | 0.292836 | 0.685713 |
    | 03.01. |  0.4 | 16.0 |   4.4 |  0.48 | 16.8 | 0.061945 | 0.030972 |  0.461681 |  0.0 | 0.030972 | 0.0 |  8.610594 |  0.0 |  0.461681 |  0.461681 |  0.0 |  0.0 | 0.0 |  0.461681 |  2.267868 | 0.769028 |  0.0 |  0.0 |  0.0 | 0.461681 |       0.0 |   0.0 |   0.0 |  0.0 | 1.159771 |  0.818175 |   0.0 |   0.0 | 0.289922 | 0.629963 |
    | 03.01. |  0.2 | 16.7 |  26.1 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.209028 |  0.0 | 0.094074 | 0.0 |  8.969368 |  0.0 |  0.209028 |  0.209028 |  0.0 |  0.0 | 0.0 |  0.209028 |  1.792852 | 0.705926 |  0.0 |  0.0 |  0.0 | 0.209028 |       0.0 |   0.0 |   0.0 |  0.0 | 1.009567 |  0.496248 |   0.0 |   0.0 | 0.287037 | 0.498015 |
    | 03.01. |  0.0 | 17.1 |  74.2 |   0.0 | 17.9 |  0.46949 | 0.234745 |       0.0 |  0.0 | 0.234745 | 0.0 |  9.174382 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.430048 | 0.471181 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.844877 |   0.30099 |   0.0 |   0.0 | 0.284181 | 0.397236 |
    | 03.01. |  0.0 | 16.2 | 287.1 |   0.0 | 17.0 | 1.680918 | 0.840459 |       0.0 |  0.0 | 0.471181 | 0.0 |  8.713101 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   1.15564 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.691727 |  0.182559 |   0.0 |   0.0 | 0.281354 | 0.321011 |
    | 03.01. |  0.3 | 15.9 | 299.8 |  0.36 | 16.7 | 1.743886 | 0.871943 |       0.0 |  0.0 |     0.36 | 0.0 |   8.55934 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.95562 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.566338 |  0.110728 |   0.0 |   0.0 | 0.278554 |  0.26545 |
    | 03.01. |  2.6 | 16.3 | 363.5 |  3.12 | 17.1 | 2.122301 | 1.061151 |      2.32 |  0.0 |      0.8 | 0.0 |  8.764354 |  0.0 |      2.32 |      2.32 |  0.0 |  0.0 | 0.0 |      2.32 |  1.113577 |      0.0 |  0.0 |  0.0 |  0.0 | 1.568966 |  0.751034 |   0.0 |   0.0 |  0.0 | 0.610618 |  0.227176 |   0.0 |   0.0 | 0.275782 | 0.309327 |
    | 03.01. |  0.7 | 16.3 | 368.4 |  0.84 | 17.1 | 2.150411 | 1.075205 |      0.04 |  0.0 |      0.8 | 0.0 |  8.764354 |  0.0 |      0.04 |      0.04 |  0.0 |  0.0 | 0.0 |      0.04 |  1.187464 |      0.0 |  0.0 |  0.0 |  0.0 |     0.04 |       0.0 |   0.0 |   0.0 |  0.0 | 0.641144 |  0.273282 |   0.0 |   0.0 | 0.273038 | 0.329851 |
    | 03.01. |  0.3 | 16.4 | 317.8 |  0.36 | 17.2 | 1.863566 | 0.931783 |       0.0 |  0.0 |     0.36 | 0.0 |  8.815608 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.964504 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.528429 |  0.165754 |   0.0 |   0.0 | 0.270322 | 0.267918 |
    | 03.01. |  0.3 | 16.5 | 534.7 |  0.36 | 17.3 | 3.115838 | 1.557919 |       0.0 |  0.0 |     0.36 | 0.0 |  8.866861 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.800807 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.432641 |  0.100535 |   0.0 |   0.0 | 0.267632 | 0.222447 |
    | 03.01. |  0.0 | 18.4 | 319.4 |   0.0 | 19.2 | 1.940627 | 0.970313 |       0.0 |  0.0 |      0.0 | 0.0 |  9.840678 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.680163 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.354216 |  0.060977 |   0.0 |   0.0 | 0.264969 | 0.188934 |
    | 03.01. |  0.0 | 18.3 | 350.6 |   0.0 | 19.1 | 2.122768 | 1.061384 |       0.0 |  0.0 |      0.0 | 0.0 |  9.789425 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.589325 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.290008 |  0.036985 |   0.0 |   0.0 | 0.262332 | 0.163701 |
    | 03.01. |  0.0 | 18.1 | 215.4 |   0.0 | 18.9 | 1.314414 | 0.657207 |       0.0 |  0.0 |      0.0 | 0.0 |  9.686918 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.519593 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.237438 |  0.022432 |   0.0 |   0.0 | 0.259722 | 0.144331 |
    | 03.01. |  0.0 | 16.7 |  97.8 |   0.0 | 17.5 | 0.602486 | 0.301243 |       0.0 |  0.0 |      0.0 | 0.0 |  8.969368 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.465142 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.194398 |  0.013606 |   0.0 |   0.0 | 0.257138 | 0.129206 |
    | 03.01. |  0.0 | 15.2 |  13.1 |   0.0 | 16.0 | 0.109905 | 0.054952 |       0.0 |  0.0 |      0.0 | 0.0 |  8.200565 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.421991 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |  0.15916 |  0.008252 |   0.0 |   0.0 | 0.254579 |  0.11722 |
    | 03.01. |  0.0 | 13.4 |   0.0 |   0.0 | 14.2 | 0.035026 | 0.017513 |       0.0 |  0.0 |      0.0 | 0.0 |  7.278002 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.38736 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.130309 |  0.005005 |   0.0 |   0.0 | 0.252046 |   0.1076 |
    | 03.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.0 |  6.765466 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.359262 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.106688 |  0.003036 |   0.0 |   0.0 | 0.249538 | 0.099795 |
    | 03.01. |  0.0 | 11.6 |   0.0 |   0.0 | 12.4 | 0.033727 | 0.016863 |       0.0 |  0.0 |      0.0 | 0.0 |  6.355438 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.336245 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.087349 |  0.001841 |   0.0 |   0.0 | 0.247055 | 0.093401 |
    | 03.01. |  0.0 | 11.0 |   0.0 |   0.0 | 11.8 | 0.033286 | 0.016643 |       0.0 |  0.0 |      0.0 | 0.0 |  6.047917 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.317229 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.071515 |  0.001117 |   0.0 |   0.0 | 0.244597 | 0.088119 |
    | 04.01. |  0.0 | 10.5 |   0.0 |   0.0 | 11.3 | 0.032916 | 0.016458 |       0.0 |  0.0 |      0.0 | 0.0 |  5.791649 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.301392 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.058552 |  0.000677 |   0.0 |   0.0 | 0.242163 |  0.08372 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.0 |  6.406692 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.288103 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.047938 |  0.000411 |   0.0 |   0.0 | 0.239754 | 0.080028 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.0 |  6.509199 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.276866 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.039248 |  0.000249 |   0.0 |   0.0 | 0.237368 | 0.076907 |
    | 04.01. |  1.3 | 11.2 |   0.0 |  1.56 | 12.0 | 0.033433 | 0.016717 |      0.76 |  0.0 | 0.016717 | 0.0 |  6.150424 |  0.0 |      0.76 |      0.76 |  0.0 |  0.0 | 0.0 |      0.76 |  0.338468 | 0.783283 |  0.0 |  0.0 |  0.0 |     0.76 |       0.0 |   0.0 |   0.0 |  0.0 | 0.103311 |  0.000151 |   0.0 |   0.0 | 0.235006 | 0.094019 |
    | 04.01. |  0.0 | 11.1 |   0.0 |   0.0 | 11.9 |  0.03336 |  0.01668 |       0.0 |  0.0 |  0.01668 | 0.0 |   6.09917 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.383931 | 0.766603 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.151171 |  0.000092 |   0.0 |   0.0 | 0.232668 | 0.106647 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 | 0.016973 | 0.0 |  6.509199 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.354177 |  0.74963 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.123769 |  0.000056 |   0.0 |   0.0 | 0.230353 | 0.098383 |
    | 04.01. |  0.0 | 12.2 |  17.0 |   0.0 | 13.0 | 0.124091 | 0.062046 |       0.0 |  0.0 | 0.062046 | 0.0 |  6.662959 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.329428 | 0.687585 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.101333 |  0.000034 |   0.0 |   0.0 | 0.228061 | 0.091508 |
    | 04.01. |  0.7 | 11.8 |  99.7 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.727585 |  0.0 | 0.278392 | 0.0 |  6.457945 |  0.0 |  0.727585 |  0.727585 |  0.0 |  0.0 | 0.0 |  0.727585 |  0.376918 | 0.521608 |  0.0 |  0.0 |  0.0 | 0.727585 |       0.0 |   0.0 |   0.0 |  0.0 | 0.151106 |   0.00002 |   0.0 |   0.0 | 0.225792 | 0.104699 |
    | 04.01. |  0.4 | 11.4 | 239.4 |  0.48 | 12.2 | 1.278351 | 0.639175 |  0.201608 |  0.0 | 0.639175 | 0.0 |  6.252931 |  0.0 |  0.201608 |  0.201608 |  0.0 |  0.0 | 0.0 |  0.201608 |  0.429901 | 0.160825 |  0.0 |  0.0 |  0.0 | 0.201608 |       0.0 |   0.0 |   0.0 |  0.0 | 0.206344 |  0.000012 |   0.0 |   0.0 | 0.223545 | 0.119417 |
    | 04.01. |  0.1 | 11.6 | 391.2 |  0.12 | 12.4 |  2.07666 |  1.03833 |       0.0 |  0.0 | 0.280825 | 0.0 |  6.355438 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.407932 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.186604 |  0.000008 |   0.0 |   0.0 | 0.221321 | 0.113315 |
    | 04.01. |  0.4 | 13.0 | 525.6 |  0.48 | 13.8 | 2.862014 | 1.431007 |       0.0 |  0.0 |     0.48 | 0.0 |  7.072988 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.371902 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.152779 |  0.000005 |   0.0 |   0.0 | 0.219118 | 0.103306 |
    | 04.01. |  0.0 | 17.1 | 570.2 |   0.0 | 17.9 | 3.356573 | 1.678286 |       0.0 |  0.0 |      0.0 | 0.0 |  9.174382 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.342025 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.125084 |  0.000003 |   0.0 |   0.0 | 0.216938 | 0.095007 |
    | 04.01. |  0.0 | 18.2 | 559.1 |   0.0 | 19.0 | 3.356514 | 1.678257 |       0.0 |  0.0 |      0.0 | 0.0 |  9.738171 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.317192 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.102411 |  0.000002 |   0.0 |   0.0 |  0.21478 | 0.088109 |
    | 04.01. |  0.0 | 22.4 | 668.0 |   0.0 | 23.2 | 4.286095 | 2.143047 |       0.0 |  0.0 |      0.0 | 0.0 |  11.89082 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.29649 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.083847 |  0.000001 |   0.0 |   0.0 | 0.212642 | 0.082358 |
    | 04.01. |  0.0 | 21.4 | 593.4 |   0.0 | 22.2 | 3.753358 | 1.876679 |       0.0 |  0.0 |      0.0 | 0.0 | 11.378284 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.279175 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.068648 |  0.000001 |   0.0 |   0.0 | 0.210527 | 0.077549 |
    | 04.01. |  0.0 | 21.8 | 493.0 |   0.0 | 22.6 | 3.144766 | 1.572383 |       0.0 |  0.0 |      0.0 | 0.0 | 11.583298 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.264636 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.056204 |       0.0 |   0.0 |   0.0 | 0.208432 |  0.07351 |
    | 04.01. |  0.0 | 22.2 | 391.2 |   0.0 | 23.0 | 2.519332 | 1.259666 |       0.0 |  0.0 |      0.0 | 0.0 | 11.788313 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.252374 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.046016 |       0.0 |   0.0 |   0.0 | 0.206358 | 0.070104 |
    | 04.01. |  0.0 | 20.1 | 186.0 |   0.0 | 20.9 | 1.179367 | 0.589683 |       0.0 |  0.0 |      0.0 | 0.0 | 10.711988 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.24198 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.037675 |       0.0 |   0.0 |   0.0 | 0.204305 | 0.067217 |
    | 04.01. |  0.0 | 17.8 |  82.4 |   0.0 | 18.6 | 0.523693 | 0.261846 |       0.0 |  0.0 |      0.0 | 0.0 |  9.533157 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.233117 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.030845 |       0.0 |   0.0 |   0.0 | 0.202272 | 0.064755 |
    | 04.01. |  0.0 | 15.2 |  17.0 |   0.0 | 16.0 |  0.13182 |  0.06591 |       0.0 |  0.0 |      0.0 | 0.0 |  8.200565 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.225513 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.025254 |       0.0 |   0.0 |   0.0 | 0.200259 | 0.062643 |
    | 04.01. |  0.0 | 14.5 |   0.0 |   0.0 | 15.3 | 0.035803 | 0.017902 |       0.0 |  0.0 |      0.0 | 0.0 |  7.841791 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.218943 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.020676 |       0.0 |   0.0 |   0.0 | 0.198267 | 0.060817 |
    | 04.01. |  0.0 | 12.4 |   0.0 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.0 |  6.765466 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.213222 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.016928 |       0.0 |   0.0 |   0.0 | 0.196294 | 0.059228 |
    | 04.01. |  0.0 | 11.7 |   0.0 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.0 |  6.406692 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |    0.2082 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |  0.01386 |       0.0 |   0.0 |   0.0 | 0.194341 | 0.057833 |
    | 04.01. |  0.0 | 11.9 |   0.0 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.0 |  6.509199 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.203754 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.011347 |       0.0 |   0.0 |   0.0 | 0.192407 | 0.056598 |

    .. raw:: html

        <iframe
            src="lland_v1_ex5.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    .. _lland_v1_ex6:

    **Example 6**

    In the sixth example, the land type is set to |ACKER| again, and the
    input temperature series |TemL| is modified, to demonstrate the
    functioning of the snow routine.  For simplicity, |TemL| increases
    constantly from -10 to +10 °C.  The ice content of the snow layer
    (WATS) starts to melt when temperature crosses the threshold temperatures
    |TGr|, |TRefT| and |TRefN|. But the actual water release from the
    snow layer (|WaDa|) starts one day later, when the water holding
    capacity of the snow layer is exceeded:

    >>> lnk(ACKER)
    >>> inputs.teml.series = numpy.linspace(-10.0, 10.0, 96)
    >>> test('lland_v1_ex6')
    |   date | nied |      teml |  glob |  nkor |      tkor |      et0 |     evpo |      nbes |      sbes |      evi |      evb |     wgtf |     schm |     wada |      qdb |     qib1 |     qib2 |      qbb |     qdgz |        q |     inzp |       wats |       waes |       bowa |    qdgz1 |    qdgz2 |    qigz1 |    qigz2 |     qbgz |    qdga1 |    qdga2 |    qiga1 |    qiga2 |     qbga |   outlet |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 |     -10.0 |   0.0 |   0.0 |      -9.2 | 0.014932 | 0.007466 |       0.0 |       0.0 |      0.0 | 0.006413 |      0.0 |      0.0 |      0.0 |      0.0 |     0.05 |      0.0 |     0.45 |      0.0 |  0.50098 |      0.0 |        0.0 |        0.0 |  99.493587 |      0.0 |      0.0 |     0.05 |      0.0 |     0.45 |      0.0 |      0.0 | 0.001229 |      0.0 | 0.499751 | 0.139161 |
    | 01.01. |  0.0 | -9.789474 |   0.0 |   0.0 | -8.989474 | 0.015149 | 0.007575 |       0.0 |       0.0 |      0.0 | 0.006493 |      0.0 |      0.0 |      0.0 |      0.0 | 0.049747 |      0.0 | 0.447468 |      0.0 | 0.502845 |      0.0 |        0.0 |        0.0 |   98.98988 |      0.0 |      0.0 | 0.049747 |      0.0 | 0.447468 |      0.0 |      0.0 | 0.003602 |      0.0 | 0.499243 | 0.139679 |
    | 01.01. |  0.0 | -9.578947 |   0.0 |   0.0 | -8.778947 | 0.015366 | 0.007683 |       0.0 |       0.0 |      0.0 | 0.006571 |      0.0 |      0.0 |      0.0 |      0.0 | 0.049495 |      0.0 | 0.444949 |      0.0 | 0.504562 |      0.0 |        0.0 |        0.0 |  98.488864 |      0.0 |      0.0 | 0.049495 |      0.0 | 0.444949 |      0.0 |      0.0 | 0.005846 |      0.0 | 0.498715 | 0.140156 |
    | 01.01. |  0.0 | -9.368421 |   0.0 |   0.0 | -8.568421 | 0.015582 | 0.007791 |       0.0 |       0.0 |      0.0 |  0.00665 |      0.0 |      0.0 |      0.0 |      0.0 | 0.049244 |      0.0 | 0.442444 |      0.0 | 0.506137 |      0.0 |        0.0 |        0.0 |  97.990526 |      0.0 |      0.0 | 0.049244 |      0.0 | 0.442444 |      0.0 |      0.0 | 0.007969 |      0.0 | 0.498168 | 0.140594 |
    | 01.01. |  0.0 | -9.157895 |   0.0 |   0.0 | -8.357895 | 0.015797 | 0.007898 |       0.0 |       0.0 |      0.0 | 0.006727 |      0.0 |      0.0 |      0.0 |      0.0 | 0.048995 |      0.0 | 0.439953 |      0.0 | 0.507577 |      0.0 |        0.0 |        0.0 |  97.494851 |      0.0 |      0.0 | 0.048995 |      0.0 | 0.439953 |      0.0 |      0.0 | 0.009976 |      0.0 | 0.497601 | 0.140994 |
    | 01.01. |  0.0 | -8.947368 |   0.0 |   0.0 | -8.147368 | 0.016011 | 0.008006 |       0.0 |       0.0 |      0.0 | 0.006803 |      0.0 |      0.0 |      0.0 |      0.0 | 0.048747 |      0.0 | 0.437474 |      0.0 | 0.508888 |      0.0 |        0.0 |        0.0 |  97.001826 |      0.0 |      0.0 | 0.048747 |      0.0 | 0.437474 |      0.0 |      0.0 | 0.011873 |      0.0 | 0.497015 | 0.141358 |
    | 01.01. |  0.0 | -8.736842 |  11.2 |   0.0 | -7.936842 | 0.044362 | 0.022181 |       0.0 |       0.0 |      0.0 | 0.018808 |      0.0 |      0.0 |      0.0 |      0.0 | 0.048501 |      0.0 | 0.435009 |      0.0 | 0.510075 |      0.0 |        0.0 |        0.0 |  96.499508 |      0.0 |      0.0 | 0.048501 |      0.0 | 0.435009 |      0.0 |      0.0 | 0.013665 |      0.0 |  0.49641 | 0.141688 |
    | 01.01. |  0.0 | -8.526316 | 105.5 |   0.0 | -7.726316 | 0.284956 | 0.142478 |       0.0 |       0.0 |      0.0 | 0.120538 |      0.0 |      0.0 |      0.0 |      0.0 |  0.04825 |      0.0 | 0.432498 |      0.0 | 0.511145 |      0.0 |        0.0 |        0.0 |  95.898223 |      0.0 |      0.0 |  0.04825 |      0.0 | 0.432498 |      0.0 |      0.0 | 0.015358 |      0.0 | 0.495787 | 0.141985 |
    | 01.01. |  0.0 | -8.315789 | 248.3 |   0.0 | -7.515789 | 0.656774 | 0.328387 |       0.0 |       0.0 |      0.0 | 0.277056 |      0.0 |      0.0 |      0.0 |      0.0 | 0.047949 |      0.0 | 0.429491 |      0.0 | 0.512097 |      0.0 |        0.0 |        0.0 |  95.143726 |      0.0 |      0.0 | 0.047949 |      0.0 | 0.429491 |      0.0 |      0.0 | 0.016954 |      0.0 | 0.495142 | 0.142249 |
    | 01.01. |  0.0 | -8.105263 | 401.3 |   0.0 | -7.305263 | 1.064551 | 0.532276 |       0.0 |       0.0 |      0.0 |   0.4475 |      0.0 |      0.0 |      0.0 |      0.0 | 0.047572 |      0.0 | 0.425719 |      0.0 | 0.512927 |      0.0 |        0.0 |        0.0 |  94.222936 |      0.0 |      0.0 | 0.047572 |      0.0 | 0.425719 |      0.0 |      0.0 | 0.018457 |      0.0 |  0.49447 |  0.14248 |
    | 01.01. |  0.0 | -7.894737 | 449.7 |   0.0 | -7.094737 | 1.205779 | 0.602889 |       0.0 |       0.0 |      0.0 | 0.504652 |      0.0 |      0.0 |      0.0 |      0.0 | 0.047111 |      0.0 | 0.421115 |      0.0 | 0.513629 |      0.0 |        0.0 |        0.0 |  93.250058 |      0.0 |      0.0 | 0.047111 |      0.0 | 0.421115 |      0.0 |      0.0 | 0.019865 |      0.0 | 0.493763 | 0.142675 |
    | 01.01. |  0.0 | -7.684211 | 493.4 |   0.0 | -6.884211 | 1.337526 | 0.668763 |       0.0 |       0.0 |      0.0 | 0.557144 |      0.0 |      0.0 |      0.0 |      0.0 | 0.046625 |      0.0 |  0.41625 |      0.0 | 0.514198 |      0.0 |        0.0 |        0.0 |  92.230038 |      0.0 |      0.0 | 0.046625 |      0.0 |  0.41625 |      0.0 |      0.0 | 0.021182 |      0.0 | 0.493016 | 0.142833 |
    | 01.01. |  0.0 | -7.473684 | 261.5 |   0.0 | -6.673684 | 0.725676 | 0.362838 |       0.0 |       0.0 |      0.0 | 0.300742 |      0.0 |      0.0 |      0.0 |      0.0 | 0.046115 |      0.0 |  0.41115 |      0.0 | 0.514637 |      0.0 |        0.0 |        0.0 |   91.47203 |      0.0 |      0.0 | 0.046115 |      0.0 |  0.41115 |      0.0 |      0.0 | 0.022411 |      0.0 | 0.492227 | 0.142955 |
    | 01.01. |  0.0 | -7.263158 | 363.6 |   0.0 | -6.463158 | 1.014111 | 0.507055 |       0.0 |       0.0 |      0.0 | 0.418653 |      0.0 |      0.0 |      0.0 |      0.0 | 0.045736 |      0.0 |  0.40736 |      0.0 | 0.514959 |      0.0 |        0.0 |        0.0 |  90.600281 |      0.0 |      0.0 | 0.045736 |      0.0 |  0.40736 |      0.0 |      0.0 | 0.023557 |      0.0 | 0.491401 | 0.143044 |
    | 01.01. |  0.0 | -7.052632 | 446.2 |   0.0 | -6.252632 |  1.25501 | 0.627505 |       0.0 |       0.0 |      0.0 | 0.515751 |      0.0 |      0.0 |      0.0 |      0.0 |   0.0453 |      0.0 | 0.403001 |      0.0 | 0.515172 |      0.0 |        0.0 |        0.0 |  89.636228 |      0.0 |      0.0 |   0.0453 |      0.0 | 0.403001 |      0.0 |      0.0 | 0.024628 |      0.0 | 0.490543 | 0.143103 |
    | 01.01. |  0.2 | -6.842105 | 137.6 |  0.24 | -6.042105 | 0.404017 | 0.202009 |       0.0 |       0.0 | 0.202009 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044818 |      0.0 | 0.398181 |      0.0 | 0.515273 | 0.037991 |        0.0 |        0.0 |  89.193229 |      0.0 |      0.0 | 0.044818 |      0.0 | 0.398181 |      0.0 |      0.0 | 0.025625 |      0.0 | 0.489648 | 0.143131 |
    | 01.01. |  0.0 | -6.631579 | 103.0 |   0.0 | -5.831579 | 0.310471 | 0.155236 |       0.0 |       0.0 | 0.037991 | 0.095638 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044597 |      0.0 | 0.395966 |      0.0 | 0.515282 |      0.0 |        0.0 |        0.0 |  88.657027 |      0.0 |      0.0 | 0.044597 |      0.0 | 0.395966 |      0.0 |      0.0 | 0.026555 |      0.0 | 0.488727 | 0.143134 |
    | 01.01. |  0.0 | -6.421053 |  63.7 |   0.0 | -5.621053 | 0.201229 | 0.100615 |       0.0 |       0.0 |      0.0 | 0.081831 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044329 |      0.0 | 0.393285 |      0.0 | 0.515219 |      0.0 |        0.0 |        0.0 |  88.137583 |      0.0 |      0.0 | 0.044329 |      0.0 | 0.393285 |      0.0 |      0.0 | 0.027429 |      0.0 | 0.487791 | 0.143116 |
    | 01.01. |  1.3 | -6.210526 |  41.4 |  1.56 | -5.410526 | 0.138783 | 0.069392 |      0.76 |      0.76 | 0.069392 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044069 |      0.0 | 0.390688 |      0.0 | 0.515084 | 0.730608 |       0.76 |       0.76 |  87.702826 |      0.0 |      0.0 | 0.044069 |      0.0 | 0.390688 |      0.0 |      0.0 | 0.028246 |      0.0 | 0.486837 | 0.143079 |
    | 01.01. |  5.6 |      -6.0 |   7.9 |  6.72 |      -5.2 |  0.04209 | 0.021045 |  6.650608 |  6.650608 | 0.021045 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.043851 |      0.0 | 0.388514 |      0.0 | 0.514883 | 0.778955 |   7.410608 |   7.410608 |  87.270461 |      0.0 |      0.0 | 0.043851 |      0.0 | 0.388514 |      0.0 |      0.0 | 0.029013 |      0.0 |  0.48587 | 0.143023 |
    | 01.01. |  2.9 | -5.789474 |   0.0 |  3.48 | -4.989474 | 0.019135 | 0.009568 |  3.458955 |  3.458955 | 0.009568 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.043635 |      0.0 | 0.386352 |      0.0 | 0.514621 | 0.790432 |  10.869563 |  10.869563 |  86.840473 |      0.0 |      0.0 | 0.043635 |      0.0 | 0.386352 |      0.0 |      0.0 | 0.029731 |      0.0 |  0.48489 |  0.14295 |
    | 01.01. |  4.9 | -5.578947 |   0.0 |  5.88 | -4.778947 | 0.019338 | 0.009669 |  5.870432 |  5.870432 | 0.009669 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 |  0.04342 |      0.0 | 0.384202 |      0.0 | 0.514303 | 0.790331 |  16.739996 |  16.739996 |   86.41285 |      0.0 |      0.0 |  0.04342 |      0.0 | 0.384202 |      0.0 |      0.0 | 0.030404 |      0.0 | 0.483899 | 0.142862 |
    | 01.01. | 10.6 | -5.368421 |   0.0 | 12.72 | -4.568421 | 0.019539 |  0.00977 | 12.710331 | 12.710331 |  0.00977 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.043206 |      0.0 | 0.382064 |      0.0 |  0.51393 |  0.79023 |  29.450327 |  29.450327 |   85.98758 |      0.0 |      0.0 | 0.043206 |      0.0 | 0.382064 |      0.0 |      0.0 | 0.031033 |      0.0 | 0.482897 | 0.142758 |
    | 01.01. |  0.1 | -5.157895 |   0.0 |  0.12 | -4.357895 |  0.01974 |  0.00987 |   0.11023 |   0.11023 |  0.00987 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042994 |      0.0 | 0.379938 |      0.0 | 0.513505 |  0.79013 |  29.560557 |  29.560557 |  85.564648 |      0.0 |      0.0 | 0.042994 |      0.0 | 0.379938 |      0.0 |      0.0 | 0.031622 |      0.0 | 0.481883 |  0.14264 |
    | 02.01. |  0.7 | -4.947368 |   0.0 |  0.84 | -4.147368 |  0.01994 |  0.00997 |   0.83013 |   0.83013 |  0.00997 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042782 |      0.0 | 0.377823 |      0.0 | 0.513029 |  0.79003 |  30.390687 |  30.390687 |  85.144042 |      0.0 |      0.0 | 0.042782 |      0.0 | 0.377823 |      0.0 |      0.0 | 0.032171 |      0.0 | 0.480858 | 0.142508 |
    | 02.01. |  3.0 | -4.736842 |   0.0 |   3.6 | -3.936842 |  0.02014 |  0.01007 |   3.59003 |   3.59003 |  0.01007 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042572 |      0.0 |  0.37572 |      0.0 | 0.512506 |  0.78993 |  33.980717 |  33.980717 |   84.72575 |      0.0 |      0.0 | 0.042572 |      0.0 |  0.37572 |      0.0 |      0.0 | 0.032684 |      0.0 | 0.479822 | 0.142363 |
    | 02.01. |  2.1 | -4.526316 |   0.0 |  2.52 | -3.726316 | 0.020338 | 0.010169 |   2.50993 |   2.50993 | 0.010169 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042363 |      0.0 | 0.373629 |      0.0 | 0.511937 | 0.789831 |  36.490647 |  36.490647 |  84.309759 |      0.0 |      0.0 | 0.042363 |      0.0 | 0.373629 |      0.0 |      0.0 | 0.033161 |      0.0 | 0.478776 | 0.142205 |
    | 02.01. | 10.4 | -4.315789 |   0.0 | 12.48 | -3.515789 | 0.020537 | 0.010268 | 12.469831 | 12.469831 | 0.010268 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042155 |      0.0 | 0.371549 |      0.0 | 0.511324 | 0.789732 |  48.960478 |  48.960478 |  83.896055 |      0.0 |      0.0 | 0.042155 |      0.0 | 0.371549 |      0.0 |      0.0 | 0.033604 |      0.0 | 0.477719 | 0.142034 |
    | 02.01. |  3.5 | -4.105263 |   0.0 |   4.2 | -3.305263 | 0.020734 | 0.010367 |  4.189732 |  4.189732 | 0.010367 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041948 |      0.0 |  0.36948 |      0.0 | 0.510669 | 0.789633 |   53.15021 |   53.15021 |  83.484627 |      0.0 |      0.0 | 0.041948 |      0.0 |  0.36948 |      0.0 |      0.0 | 0.034016 |      0.0 | 0.476652 | 0.141852 |
    | 02.01. |  3.4 | -3.894737 |   0.0 |  4.08 | -3.094737 | 0.020931 | 0.010465 |  4.069633 |  4.069633 | 0.010465 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041742 |      0.0 | 0.367423 |      0.0 | 0.509974 | 0.789535 |  57.219843 |  57.219843 |  83.075461 |      0.0 |      0.0 | 0.041742 |      0.0 | 0.367423 |      0.0 |      0.0 | 0.034398 |      0.0 | 0.475576 | 0.141659 |
    | 02.01. |  1.2 | -3.684211 |   6.1 |  1.44 | -2.884211 | 0.041081 |  0.02054 |  1.429535 |  1.429535 |  0.02054 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041538 |      0.0 | 0.365377 |      0.0 | 0.509241 |  0.77946 |  58.649378 |  58.649378 |  82.668546 |      0.0 |      0.0 | 0.041538 |      0.0 | 0.365377 |      0.0 |      0.0 | 0.034751 |      0.0 |  0.47449 | 0.141456 |
    | 02.01. |  0.1 | -3.473684 |  77.9 |  0.12 | -2.673684 | 0.278504 | 0.139252 |   0.09946 |   0.09946 | 0.139252 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041334 |      0.0 | 0.363343 |      0.0 | 0.508471 | 0.660748 |  58.748837 |  58.748837 |  82.263869 |      0.0 |      0.0 | 0.041334 |      0.0 | 0.363343 |      0.0 |      0.0 | 0.035077 |      0.0 | 0.473394 | 0.141242 |
    | 02.01. |  0.0 | -3.263158 | 196.7 |   0.0 | -2.463158 | 0.676838 | 0.338419 |       0.0 |       0.0 | 0.338419 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041132 |      0.0 | 0.361319 |      0.0 | 0.507666 | 0.322329 |  58.748837 |  58.748837 |  81.861418 |      0.0 |      0.0 | 0.041132 |      0.0 | 0.361319 |      0.0 |      0.0 | 0.035377 |      0.0 | 0.472289 | 0.141018 |
    | 02.01. |  0.0 | -3.052632 | 121.9 |   0.0 | -2.252632 |  0.43149 | 0.215745 |       0.0 |       0.0 | 0.215745 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040931 |      0.0 | 0.359307 |      0.0 | 0.506828 | 0.106584 |  58.748837 |  58.748837 |   81.46118 |      0.0 |      0.0 | 0.040931 |      0.0 | 0.359307 |      0.0 |      0.0 | 0.035653 |      0.0 | 0.471174 | 0.140785 |
    | 02.01. |  0.4 | -2.842105 | 156.6 |  0.48 | -2.042105 | 0.553018 | 0.276509 |       0.0 |       0.0 | 0.276509 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040731 |      0.0 | 0.357306 |      0.0 | 0.505957 | 0.310075 |  58.748837 |  58.748837 |  81.063144 |      0.0 |      0.0 | 0.040731 |      0.0 | 0.357306 |      0.0 |      0.0 | 0.035906 |      0.0 | 0.470051 | 0.140544 |
    | 02.01. |  0.1 | -2.631579 | 404.7 |  0.12 | -1.831579 | 1.406718 | 0.703359 |       0.0 |       0.0 | 0.430075 | 0.212168 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040532 |      0.0 | 0.355316 |      0.0 | 0.505056 |      0.0 |  58.748837 |  58.748837 |  80.455128 |      0.0 |      0.0 | 0.040532 |      0.0 | 0.355316 |      0.0 |      0.0 | 0.036136 |      0.0 |  0.46892 | 0.140293 |
    | 02.01. |  3.6 | -2.421053 | 217.9 |  4.32 | -1.621053 | 0.774277 | 0.387138 |      3.52 |      3.52 | 0.387138 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040228 |      0.0 | 0.352276 |      0.0 | 0.504117 | 0.412862 |  62.268837 |  62.268837 |  80.062625 |      0.0 |      0.0 | 0.040228 |      0.0 | 0.352276 |      0.0 |      0.0 | 0.036343 |      0.0 | 0.467774 | 0.140032 |
    | 02.01. |  5.9 | -2.210526 | 582.0 |  7.08 | -1.410526 | 2.048239 | 1.024119 |  6.692862 |  6.692862 |      0.8 | 0.172813 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040031 |      0.0 | 0.350313 |      0.0 | 0.503143 |      0.0 |  68.961699 |  68.961699 |  79.499467 |      0.0 |      0.0 | 0.040031 |      0.0 | 0.350313 |      0.0 |      0.0 | 0.036528 |      0.0 | 0.466615 | 0.139762 |
    | 02.01. |  1.1 |      -2.0 | 263.9 |  1.32 |      -1.2 | 0.949011 | 0.474506 |      0.52 |      0.52 | 0.474506 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 |  0.03975 |      0.0 | 0.347497 |      0.0 | 0.502135 | 0.325494 |  69.481699 |  69.481699 |   79.11222 |      0.0 |      0.0 |  0.03975 |      0.0 | 0.347497 |      0.0 |      0.0 | 0.036692 |      0.0 | 0.465444 | 0.139482 |
    | 02.01. | 20.7 | -1.789474 | 136.8 | 24.84 | -0.989474 | 0.507078 | 0.253539 | 24.365494 | 24.365494 | 0.253539 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.039556 |      0.0 | 0.345561 |      0.0 | 0.501096 | 0.546461 |  93.847193 |  93.847193 |  78.727103 |      0.0 |      0.0 | 0.039556 |      0.0 | 0.345561 |      0.0 |      0.0 | 0.036836 |      0.0 | 0.464261 | 0.139193 |
    | 02.01. | 37.9 | -1.578947 | 146.6 | 45.48 | -0.778947 | 0.546253 | 0.273126 | 45.226461 | 45.226461 | 0.273126 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.039364 |      0.0 | 0.343636 |      0.0 | 0.500034 | 0.526874 | 139.073654 | 139.073654 |  78.344104 |      0.0 |      0.0 | 0.039364 |      0.0 | 0.343636 |      0.0 |      0.0 | 0.036964 |      0.0 |  0.46307 | 0.138898 |
    | 02.01. |  8.2 | -1.368421 | 190.6 |  9.84 | -0.568421 | 0.709041 |  0.35452 |  9.566874 |  9.566874 |  0.35452 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.039172 |      0.0 | 0.341721 |      0.0 | 0.498948 |  0.44548 | 148.640528 | 148.640528 |  77.963211 |      0.0 |      0.0 | 0.039172 |      0.0 | 0.341721 |      0.0 |      0.0 | 0.037076 |      0.0 | 0.461872 | 0.138597 |
    | 02.01. |  3.6 | -1.157895 | 103.5 |  4.32 | -0.357895 | 0.398845 | 0.199422 |   3.96548 |   3.96548 | 0.199422 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.038982 |      0.0 | 0.339816 |      0.0 | 0.497841 | 0.600578 | 152.606007 | 152.606007 |  77.584414 |      0.0 |      0.0 | 0.038982 |      0.0 | 0.339816 |      0.0 |      0.0 | 0.037174 |      0.0 | 0.460667 | 0.138289 |
    | 02.01. |  7.5 | -0.947368 |  13.8 |   9.0 | -0.147368 | 0.074069 | 0.037035 |  8.800578 |  8.800578 | 0.037035 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.038792 |      0.0 | 0.337922 |      0.0 | 0.496712 | 0.762965 | 161.406585 | 161.406585 |  77.207699 |      0.0 |      0.0 | 0.038792 |      0.0 | 0.337922 |      0.0 |      0.0 | 0.037257 |      0.0 | 0.459455 | 0.137976 |
    | 02.01. | 18.5 | -0.736842 |   0.0 |  22.2 |  0.063158 |   0.0238 |   0.0119 | 22.162965 | 21.463082 |   0.0119 |      0.0 | 0.032371 | 0.032371 |      0.0 |      0.0 | 0.038604 |      0.0 | 0.336038 |      0.0 | 0.495564 |   0.7881 | 182.837297 |  183.56955 |  76.833057 |      0.0 |      0.0 | 0.038604 |      0.0 | 0.336038 |      0.0 |      0.0 | 0.037327 |      0.0 | 0.458236 | 0.137657 |
    | 02.01. | 15.4 | -0.526316 |   0.0 | 18.48 |  0.273684 | 0.023986 | 0.011993 |   18.4681 | 15.940886 | 0.011993 |      0.0 | 0.140273 | 0.140273 |      0.0 |      0.0 | 0.038417 |      0.0 | 0.334165 |      0.0 | 0.494396 | 0.788007 |  198.63791 |  202.03765 |  76.460475 |      0.0 |      0.0 | 0.038417 |      0.0 | 0.334165 |      0.0 |      0.0 | 0.037385 |      0.0 | 0.457011 | 0.137332 |
    | 02.01. |  6.3 | -0.315789 |   0.0 |  7.56 |  0.484211 | 0.024171 | 0.012086 |  7.548007 |  5.720595 | 0.012086 |      0.0 | 0.248175 | 0.248175 |      0.0 |      0.0 |  0.03823 |      0.0 | 0.332302 |      0.0 |  0.49321 | 0.787914 |  204.11033 | 209.585657 |  76.089943 |      0.0 |      0.0 |  0.03823 |      0.0 | 0.332302 |      0.0 |      0.0 | 0.037431 |      0.0 | 0.455779 | 0.137003 |
    | 02.01. |  1.9 | -0.105263 |   0.0 |  2.28 |  0.694737 | 0.024356 | 0.012178 |  2.267914 |  1.480112 | 0.012178 |      0.0 | 0.356077 | 0.356077 |      0.0 |      0.0 | 0.038045 |      0.0 |  0.33045 |      0.0 | 0.492007 | 0.787822 | 205.234365 | 211.853572 |  75.721448 |      0.0 |      0.0 | 0.038045 |      0.0 |  0.33045 |      0.0 |      0.0 | 0.037465 |      0.0 | 0.454542 | 0.136669 |
    | 03.01. |  4.9 |  0.105263 |   0.0 |  5.88 |  0.905263 |  0.02454 |  0.01227 |  5.867822 |   3.21186 |  0.01227 |      0.0 | 0.463979 | 0.463979 |      0.0 |      0.0 | 0.037861 |      0.0 | 0.328607 |      0.0 | 0.490787 |  0.78773 | 207.982246 | 217.721394 |   75.35498 |      0.0 |      0.0 | 0.037861 |      0.0 | 0.328607 |      0.0 |      0.0 | 0.037489 |      0.0 | 0.453298 |  0.13633 |
    | 03.01. |  2.7 |  0.315789 |   0.0 |  3.24 |  1.115789 | 0.024724 | 0.012362 |   3.22773 |  1.426996 | 0.012362 |      0.0 | 0.571882 | 0.571882 |      0.0 |      0.0 | 0.037677 |      0.0 | 0.326775 |      0.0 | 0.489551 | 0.787638 | 208.837361 | 220.949123 |  74.990528 |      0.0 |      0.0 | 0.037677 |      0.0 | 0.326775 |      0.0 |      0.0 | 0.037503 |      0.0 | 0.452048 | 0.135986 |
    | 03.01. |  0.5 |  0.526316 |   0.0 |   0.6 |  1.326316 | 0.024907 | 0.012453 |  0.587638 |  0.197941 | 0.012453 |      0.0 | 0.679784 | 0.679784 |      0.0 |      0.0 | 0.037495 |      0.0 | 0.324953 |      0.0 | 0.488299 | 0.787547 | 208.355519 | 221.536761 |   74.62808 |      0.0 |      0.0 | 0.037495 |      0.0 | 0.324953 |      0.0 |      0.0 | 0.037507 |      0.0 | 0.450792 | 0.135639 |
    | 03.01. |  0.2 |  0.736842 |   0.0 |  0.24 |  1.536842 | 0.025089 | 0.012545 |  0.227547 |  0.052695 | 0.012545 |      0.0 | 0.787686 | 0.787686 |      0.0 |      0.0 | 0.037314 |      0.0 |  0.32314 |      0.0 | 0.487033 | 0.787455 | 207.620528 | 221.764308 |  74.267625 |      0.0 |      0.0 | 0.037314 |      0.0 |  0.32314 |      0.0 |      0.0 | 0.037502 |      0.0 | 0.449531 | 0.135287 |
    | 03.01. |  0.5 |  0.947368 |   0.0 |   0.6 |  1.747368 | 0.025271 | 0.012635 |  0.587455 |  0.074205 | 0.012635 |      0.0 | 0.895588 | 0.895588 |      0.0 |      0.0 | 0.037134 |      0.0 | 0.321338 |      0.0 | 0.485753 | 0.787365 | 206.799144 | 222.351763 |  73.909153 |      0.0 |      0.0 | 0.037134 |      0.0 | 0.321338 |      0.0 |      0.0 | 0.037488 |      0.0 | 0.448265 | 0.134931 |
    | 03.01. |  2.4 |  1.157895 |   0.0 |  2.88 |  1.957895 | 0.025452 | 0.012726 |  2.867365 |  0.060366 | 0.012726 |      0.0 |  1.00349 |  1.00349 |      0.0 |      0.0 | 0.036955 |      0.0 | 0.319546 |      0.0 | 0.484459 | 0.787274 |  205.85602 | 225.219128 |  73.552653 |      0.0 |      0.0 | 0.036955 |      0.0 | 0.319546 |      0.0 |      0.0 | 0.037466 |      0.0 | 0.446993 | 0.134572 |
    | 03.01. |  0.4 |  1.368421 |   4.4 |  0.48 |  2.168421 | 0.043096 | 0.021548 |  0.467274 |       0.0 | 0.021548 |      0.0 | 1.111392 | 1.111392 |      0.0 |      0.0 | 0.036776 |      0.0 | 0.317763 |      0.0 | 0.483153 | 0.778452 | 204.744627 | 225.686402 |  73.198113 |      0.0 |      0.0 | 0.036776 |      0.0 | 0.317763 |      0.0 |      0.0 | 0.037437 |      0.0 | 0.445716 | 0.134209 |
    | 03.01. |  0.2 |  1.578947 |  26.1 |  0.24 |  2.378947 | 0.130127 | 0.065064 |  0.218452 |       0.0 | 0.065064 |      0.0 | 1.219295 | 1.219295 |      0.0 |      0.0 | 0.036599 |      0.0 | 0.315991 |      0.0 | 0.481834 | 0.734936 | 203.525333 | 225.904854 |  72.845524 |      0.0 |      0.0 | 0.036599 |      0.0 | 0.315991 |      0.0 |      0.0 |   0.0374 |      0.0 | 0.444434 | 0.133843 |
    | 03.01. |  0.0 |  1.789474 |  74.2 |   0.0 |  2.589474 | 0.324609 | 0.162305 |       0.0 |       0.0 | 0.162305 |      0.0 | 1.327197 | 1.327197 |      0.0 |      0.0 | 0.036423 |      0.0 | 0.314228 |      0.0 | 0.480504 | 0.572632 | 202.198136 | 225.904854 |  72.494873 |      0.0 |      0.0 | 0.036423 |      0.0 | 0.314228 |      0.0 |      0.0 | 0.037357 |      0.0 | 0.443147 | 0.133473 |
    | 03.01. |  0.0 |       2.0 | 287.1 |   0.0 |       2.8 | 1.189546 | 0.594773 |       0.0 |       0.0 | 0.572632 | 0.016113 | 1.435099 | 1.435099 |      0.0 |      0.0 | 0.036247 |      0.0 | 0.312474 |      0.0 | 0.479163 |      0.0 | 200.763037 | 225.904854 |  72.130039 |      0.0 |      0.0 | 0.036247 |      0.0 | 0.312474 |      0.0 |      0.0 | 0.037307 |      0.0 | 0.441855 | 0.133101 |
    | 03.01. |  0.3 |  2.210526 | 299.8 |  0.36 |  3.010526 | 1.249452 | 0.624726 |       0.0 |       0.0 |     0.36 | 0.192054 | 1.543001 | 1.543001 |      0.0 |      0.0 | 0.036065 |      0.0 |  0.31065 |      0.0 |  0.47781 |      0.0 | 199.220036 | 225.904854 |   71.59127 |      0.0 |      0.0 | 0.036065 |      0.0 |  0.31065 |      0.0 |      0.0 | 0.037251 |      0.0 | 0.440559 | 0.132725 |
    | 03.01. |  2.6 |  2.421053 | 363.5 |  3.12 |  3.221053 | 1.519497 | 0.759748 |      2.32 |       0.0 | 0.759748 |      0.0 | 1.650903 | 1.650903 |      0.0 |      0.0 | 0.035796 |      0.0 | 0.307956 |      0.0 | 0.476439 | 0.040252 | 197.569133 | 228.224854 |  71.247518 |      0.0 |      0.0 | 0.035796 |      0.0 | 0.307956 |      0.0 |      0.0 | 0.037187 |      0.0 | 0.439253 | 0.132344 |
    | 03.01. |  0.7 |  2.631579 | 368.4 |  0.84 |  3.431579 | 1.549889 | 0.774944 |  0.080252 |       0.0 | 0.774944 |      0.0 | 1.758805 | 1.758805 |      0.0 |      0.0 | 0.035624 |      0.0 | 0.306238 |      0.0 | 0.475052 | 0.025056 | 195.810327 | 228.305106 |  70.905657 |      0.0 |      0.0 | 0.035624 |      0.0 | 0.306238 |      0.0 |      0.0 | 0.037114 |      0.0 | 0.437938 | 0.131959 |
    | 03.01. |  0.3 |  2.842105 | 317.8 |  0.36 |  3.642105 | 1.349529 | 0.674765 |       0.0 |       0.0 | 0.385056 | 0.207965 | 1.866708 | 1.866708 |      0.0 |      0.0 | 0.035453 |      0.0 | 0.304528 |      0.0 | 0.473657 |      0.0 |  193.94362 | 228.305106 |  70.357711 |      0.0 |      0.0 | 0.035453 |      0.0 | 0.304528 |      0.0 |      0.0 | 0.037038 |      0.0 | 0.436619 | 0.131571 |
    | 03.01. |  0.3 |  3.052632 | 534.7 |  0.36 |  3.852632 | 2.266967 | 1.133484 |       0.0 |       0.0 |     0.36 | 0.552551 |  1.97461 |  1.97461 |      0.0 |      0.0 | 0.035179 |      0.0 | 0.301789 |      0.0 | 0.472245 |      0.0 |  191.96901 | 228.305106 |  69.468192 |      0.0 |      0.0 | 0.035179 |      0.0 | 0.301789 |      0.0 |      0.0 | 0.036954 |      0.0 | 0.435291 | 0.131179 |
    | 03.01. |  0.0 |  3.263158 | 319.4 |   0.0 |  4.063158 |  1.37389 | 0.686945 |       0.0 |       0.0 |      0.0 | 0.486807 | 2.082512 | 2.082512 |      0.0 |      0.0 | 0.034734 |      0.0 | 0.297341 |      0.0 | 0.470797 |      0.0 | 189.886498 | 228.305106 |   68.64931 |      0.0 |      0.0 | 0.034734 |      0.0 | 0.297341 |      0.0 |      0.0 | 0.036856 |      0.0 |  0.43394 | 0.130777 |
    | 03.01. |  0.0 |  3.473684 | 350.6 |   0.0 |  4.273684 | 1.515085 | 0.757543 |       0.0 |       0.0 |      0.0 | 0.532795 | 2.190414 | 2.190414 |      0.0 |      0.0 | 0.034325 |      0.0 | 0.293247 |      0.0 | 0.469303 |      0.0 | 187.696084 | 228.305106 |  67.788944 |      0.0 |      0.0 | 0.034325 |      0.0 | 0.293247 |      0.0 |      0.0 | 0.036742 |      0.0 | 0.432561 | 0.130362 |
    | 03.01. |  0.0 |  3.684211 | 215.4 |   0.0 |  4.484211 | 0.947375 | 0.473688 |       0.0 |       0.0 |      0.0 | 0.330459 | 2.298316 | 2.298316 |      0.0 |      0.0 | 0.033894 |      0.0 | 0.288945 |      0.0 | 0.467767 |      0.0 | 185.397768 | 228.305106 |  67.135645 |      0.0 |      0.0 | 0.033894 |      0.0 | 0.288945 |      0.0 |      0.0 | 0.036614 |      0.0 | 0.431153 | 0.129935 |
    | 03.01. |  0.0 |  3.894737 |  97.8 |   0.0 |  4.694737 | 0.448001 | 0.224001 |       0.0 |       0.0 |      0.0 |  0.15529 | 2.406218 | 2.406218 |      0.0 |      0.0 | 0.033568 |      0.0 | 0.285678 |      0.0 | 0.466195 |      0.0 | 182.991549 | 228.305106 |   66.66111 |      0.0 |      0.0 | 0.033568 |      0.0 | 0.285678 |      0.0 |      0.0 | 0.036473 |      0.0 | 0.429722 | 0.129499 |
    | 03.01. |  0.0 |  4.105263 |  13.1 |   0.0 |  4.905263 | 0.084566 | 0.042283 |       0.0 |       0.0 |      0.0 | 0.029177 | 2.514121 | 2.514121 |      0.0 |      0.0 | 0.033331 |      0.0 | 0.283306 |      0.0 | 0.464603 |      0.0 | 180.477428 | 228.305106 |  66.315296 |      0.0 |      0.0 | 0.033331 |      0.0 | 0.283306 |      0.0 |      0.0 | 0.036326 |      0.0 | 0.428277 | 0.129056 |
    | 03.01. |  0.0 |  4.315789 |   0.0 |   0.0 |  5.115789 | 0.028097 | 0.014048 |       0.0 |       0.0 |      0.0 | 0.009661 | 2.622023 | 2.622023 |      0.0 |      0.0 | 0.033158 |      0.0 | 0.281576 |      0.0 | 0.463001 |      0.0 | 177.855406 | 228.305106 |  65.990901 |      0.0 |      0.0 | 0.033158 |      0.0 | 0.281576 |      0.0 |      0.0 | 0.036175 |      0.0 | 0.426826 | 0.128611 |
    | 03.01. |  0.0 |  4.526316 |   0.0 |   0.0 |  5.326316 | 0.028268 | 0.014134 |       0.0 |       0.0 |      0.0 | 0.009689 | 2.729925 | 2.729925 |      0.0 |      0.0 | 0.032995 |      0.0 | 0.279955 |      0.0 | 0.461397 |      0.0 | 175.125481 | 228.305106 |  65.668263 |      0.0 |      0.0 | 0.032995 |      0.0 | 0.279955 |      0.0 |      0.0 | 0.036024 |      0.0 | 0.425372 | 0.128166 |
    | 03.01. |  0.0 |  4.736842 |   0.0 |   0.0 |  5.536842 |  0.02844 |  0.01422 |       0.0 |       0.0 |      0.0 | 0.009716 | 2.837827 | 2.837827 |      0.0 |      0.0 | 0.032834 |      0.0 | 0.278341 |      0.0 |  0.45979 |      0.0 | 172.287653 | 228.305106 |  65.347372 |      0.0 |      0.0 | 0.032834 |      0.0 | 0.278341 |      0.0 |      0.0 | 0.035873 |      0.0 | 0.423917 | 0.127719 |
    | 03.01. |  0.0 |  4.947368 |   0.0 |   0.0 |  5.747368 |  0.02861 | 0.014305 |       0.0 |       0.0 |      0.0 | 0.009742 | 2.945729 | 2.945729 |      0.0 |      0.0 | 0.032674 |      0.0 | 0.276737 |      0.0 | 0.458181 |      0.0 | 169.341924 | 228.305106 |  65.028219 |      0.0 |      0.0 | 0.032674 |      0.0 | 0.276737 |      0.0 |      0.0 |  0.03572 |      0.0 | 0.422461 | 0.127273 |
    | 04.01. |  0.0 |  5.157895 |   0.0 |   0.0 |  5.957895 |  0.02878 |  0.01439 |       0.0 |       0.0 |      0.0 | 0.009768 | 3.053632 | 3.053632 |      0.0 |      0.0 | 0.032514 |      0.0 | 0.275141 |      0.0 | 0.456571 |      0.0 | 166.288292 | 228.305106 |  64.710796 |      0.0 |      0.0 | 0.032514 |      0.0 | 0.275141 |      0.0 |      0.0 | 0.035568 |      0.0 | 0.421003 | 0.126825 |
    | 04.01. |  0.0 |  5.368421 |   0.0 |   0.0 |  6.168421 |  0.02895 | 0.014475 |       0.0 |       0.0 |      0.0 | 0.009793 | 3.161534 | 3.161534 |      0.0 |      0.0 | 0.032355 |      0.0 | 0.273554 |      0.0 | 0.454959 |      0.0 | 163.126759 | 228.305106 |  64.395093 |      0.0 |      0.0 | 0.032355 |      0.0 | 0.273554 |      0.0 |      0.0 | 0.035415 |      0.0 | 0.419544 | 0.126377 |
    | 04.01. |  0.0 |  5.578947 |   0.0 |   0.0 |  6.378947 | 0.029118 | 0.014559 |       0.0 |       0.0 |      0.0 | 0.009818 | 3.269436 | 3.269436 | 4.504854 | 0.490564 | 0.032198 |      0.0 | 0.271975 | 0.490564 | 0.499288 |      0.0 | 159.857323 | 223.800252 |  68.095392 | 0.490564 |      0.0 | 0.032198 |      0.0 | 0.271975 | 0.045943 |      0.0 | 0.035262 |      0.0 | 0.418083 | 0.138691 |
    | 04.01. |  1.3 |  5.789474 |   0.0 |  1.56 |  6.589474 | 0.029287 | 0.014643 |      0.76 |       0.0 | 0.014643 |      0.0 | 3.377338 | 3.377338 | 5.488273 | 0.641231 | 0.034048 |      0.0 | 0.290477 | 0.641231 | 0.592529 | 0.785357 | 156.479985 | 219.071979 |  72.617909 | 0.641231 |      0.0 | 0.034048 |      0.0 | 0.290477 |  0.14065 |      0.0 | 0.035158 |      0.0 | 0.416722 | 0.164592 |
    | 04.01. |  0.0 |       6.0 |   0.0 |   0.0 |       6.8 | 0.029455 | 0.014727 |       0.0 |       0.0 | 0.014727 |      0.0 |  3.48524 |  3.48524 | 4.879336 | 0.610802 | 0.036309 |      0.0 |  0.31309 | 0.610802 | 0.679278 | 0.770629 | 152.994745 | 214.192642 |  76.537045 | 0.610802 |      0.0 | 0.036309 |      0.0 |  0.31309 |  0.22854 |      0.0 |  0.03516 |      0.0 | 0.415578 | 0.188688 |
    | 04.01. |  0.0 |  6.210526 |   0.0 |   0.0 |  7.010526 | 0.029622 | 0.014811 |       0.0 |       0.0 | 0.014811 |      0.0 | 3.593142 | 3.593142 | 5.030399 | 0.669984 | 0.038269 |      0.0 | 0.332685 | 0.669984 | 0.753295 | 0.755818 | 149.401602 | 209.162243 |  80.526507 | 0.669984 |      0.0 | 0.038269 |      0.0 | 0.332685 | 0.303375 |      0.0 | 0.035264 |      0.0 | 0.414656 | 0.209249 |
    | 04.01. |  0.0 |  6.421053 |  17.0 |   0.0 |  7.221053 |   0.1082 |   0.0541 |       0.0 |       0.0 |   0.0541 |      0.0 | 3.701045 | 3.701045 | 5.181462 | 0.733305 | 0.040263 |      0.0 | 0.352633 | 0.733305 | 0.825159 | 0.701718 | 145.700558 | 203.980781 |  84.581769 | 0.733305 |      0.0 | 0.040263 |      0.0 | 0.352633 |  0.37576 |      0.0 | 0.035459 |      0.0 |  0.41394 | 0.229211 |
    | 04.01. |  0.7 |  6.631579 |  99.7 |  0.84 |  7.431579 |  0.49238 |  0.24619 |  0.741718 |       0.0 |  0.24619 |      0.0 | 3.808947 | 3.808947 | 6.074244 | 0.916515 | 0.042291 |      0.0 | 0.372909 | 0.916515 | 0.906905 |  0.55381 | 141.891611 | 198.648255 |  89.324298 | 0.916515 |      0.0 | 0.042291 |      0.0 | 0.372909 |  0.45773 |      0.0 | 0.035743 |      0.0 | 0.413431 | 0.251918 |
    | 04.01. |  0.4 |  6.842105 | 239.4 |  0.48 |  7.642105 | 1.146638 | 0.573319 |   0.23381 |       0.0 | 0.573319 |      0.0 | 3.916849 | 3.916849 | 5.717398 | 0.919577 | 0.044662 |      0.0 | 0.396621 | 0.919577 | 0.990448 | 0.226681 | 137.974762 | 193.164667 |  93.680836 | 0.919577 |      0.0 | 0.044662 |      0.0 | 0.396621 | 0.541181 |      0.0 | 0.036121 |      0.0 | 0.413146 | 0.275124 |
    | 04.01. |  0.1 |  7.052632 | 391.2 |  0.12 |  7.852632 | 1.864772 | 0.932386 |       0.0 |       0.0 | 0.346681 | 0.488982 | 4.024751 | 4.024751 | 5.634652 | 0.960633 |  0.04684 |      0.0 | 0.418404 | 0.960633 | 1.063298 |      0.0 | 133.950011 | 187.530015 |  97.400628 | 0.960633 |      0.0 |  0.04684 |      0.0 | 0.418404 | 0.613617 |      0.0 | 0.036591 |      0.0 |  0.41309 | 0.295361 |
    | 04.01. |  0.4 |  7.263158 | 525.6 |  0.48 |  8.063158 | 2.508585 | 1.254293 |       0.0 |       0.0 |     0.48 | 0.657717 | 4.132653 | 4.132653 | 5.785715 | 1.036605 |   0.0487 |      0.0 | 0.437003 | 1.036605 | 1.134162 |      0.0 | 129.817357 |   181.7443 | 101.006317 | 1.035313 | 0.001293 |   0.0487 |      0.0 | 0.437003 | 0.683515 | 0.000275 | 0.037137 |      0.0 | 0.413236 | 0.315045 |
    | 04.01. |  0.0 |  7.473684 | 570.2 |   0.0 |  8.273684 | 2.733517 | 1.366759 |       0.0 |       0.0 |      0.0 | 1.178878 | 4.240555 | 4.240555 | 5.936778 | 1.114955 | 0.050503 | 0.000909 | 0.455032 | 1.114955 |  1.20791 |      0.0 | 125.576802 | 175.807523 | 104.142819 | 1.103103 | 0.011852 | 0.050503 | 0.000909 | 0.455032 | 0.753634 | 0.002925 | 0.037745 | 0.000044 | 0.413562 | 0.335531 |
    | 04.01. |  0.0 |  7.684211 | 559.1 |   0.0 |  8.484211 | 2.695221 |  1.34761 |       0.0 |       0.0 |      0.0 | 1.176649 | 4.348458 | 4.348458 | 6.087841 | 1.190331 | 0.052071 | 0.007589 | 0.470714 | 1.190331 | 1.285605 |      0.0 | 121.228344 | 169.719682 | 107.333304 | 1.159898 | 0.030433 | 0.052071 | 0.007589 | 0.470714 | 0.822301 | 0.010397 | 0.038406 | 0.000449 | 0.414053 | 0.357113 |
    | 04.01. |  0.0 |  7.894737 | 668.0 |   0.0 |  8.694737 | 3.231218 | 1.615609 |       0.0 |       0.0 |      0.0 | 1.426926 |  4.45636 |  4.45636 | 6.238904 | 1.270041 | 0.053667 | 0.017873 | 0.486667 | 1.270041 | 1.367898 |      0.0 | 116.771984 | 163.480778 | 110.317035 | 1.212624 | 0.057417 | 0.053667 | 0.017873 | 0.486667 | 0.888435 |  0.02403 | 0.039112 | 0.001626 | 0.414696 | 0.379972 |
    | 04.01. |  0.0 |  8.105263 | 593.4 |   0.0 |  8.905263 | 2.888914 | 1.444457 |       0.0 |       0.0 |      0.0 | 1.288488 | 4.564262 | 4.564262 | 6.389967 |  1.35009 | 0.055159 | 0.029825 | 0.501585 |  1.35009 | 1.454943 |      0.0 | 112.207723 | 157.090812 | 113.481855 | 1.259309 | 0.090782 | 0.055159 | 0.029825 | 0.501585 | 0.951572 | 0.044275 | 0.039858 | 0.003751 | 0.415486 | 0.404151 |
    | 04.01. |  0.0 |  8.315789 | 493.0 |   0.0 |  9.115789 | 2.417915 | 1.208957 |       0.0 |       0.0 |      0.0 | 1.088977 | 4.672164 | 4.672164 |  6.54103 | 1.436822 | 0.056741 | 0.044552 | 0.517409 | 1.436822 | 1.547079 |      0.0 | 107.535558 | 150.549782 | 116.878383 |  1.30402 | 0.132803 | 0.056741 | 0.044552 | 0.517409 | 1.011543 | 0.071527 | 0.040643 | 0.006944 | 0.416422 | 0.429744 |
    | 04.01. |  0.0 |  8.526316 | 391.2 |   0.0 |  9.326316 | 1.935035 | 0.967517 |       0.0 |       0.0 |      0.0 | 0.879931 | 4.780066 | 4.780066 | 6.692093 | 1.531798 | 0.058439 | 0.062408 | 0.534392 | 1.531798 | 1.645648 |      0.0 | 102.755492 | 143.857689 | 120.503509 | 1.347172 | 0.184625 | 0.058439 | 0.062408 | 0.534392 | 1.068601 | 0.106679 |  0.04147 | 0.011387 | 0.417511 | 0.457125 |
    | 04.01. |  0.0 |  8.736842 | 186.0 |   0.0 |  9.536842 | 0.941313 | 0.470656 |       0.0 |       0.0 |      0.0 | 0.432096 | 4.887969 | 4.887969 | 6.843156 | 1.635847 | 0.060252 | 0.083557 | 0.552518 | 1.635847 | 1.752029 |      0.0 |  97.867524 | 137.014533 | 124.582395 | 1.388696 | 0.247151 | 0.060252 | 0.083557 | 0.552518 | 1.122987 |  0.15067 | 0.042342 | 0.017265 | 0.418765 | 0.486675 |
    | 04.01. |  0.0 |  8.947368 |  82.4 |   0.0 |  9.747368 | 0.436813 | 0.218407 |       0.0 |       0.0 |      0.0 |  0.20245 | 4.995871 | 4.995871 | 6.994219 |  1.75458 | 0.062291 | 0.109693 | 0.572912 |  1.75458 | 1.868443 |      0.0 |  92.871653 | 130.020314 | 128.874688 | 1.430063 | 0.324517 | 0.062291 | 0.109693 | 0.572912 | 1.175026 | 0.205116 | 0.043266 | 0.024838 | 0.420197 | 0.519012 |
    | 04.01. |  0.0 |  9.157895 |  17.0 |   0.0 |  9.957895 | 0.115898 | 0.057949 |       0.0 |       0.0 |      0.0 | 0.054207 | 5.103773 | 5.103773 | 7.145282 | 1.884901 | 0.064437 | 0.139643 | 0.594373 | 1.884901 | 1.996846 |      0.0 |   87.76788 | 122.875032 | 133.282409 | 1.469468 | 0.415433 | 0.064437 | 0.139643 | 0.594373 | 1.224946 | 0.271467 | 0.044247 | 0.034362 | 0.421824 | 0.554679 |
    | 04.01. |  0.0 |  9.368421 |   0.0 |   0.0 | 10.168421 | 0.032067 | 0.016034 |       0.0 |       0.0 |      0.0 | 0.015125 | 5.211675 | 5.211675 | 7.296345 | 2.026056 | 0.066641 | 0.172808 | 0.616412 | 2.026056 | 2.137966 |      0.0 |  82.556205 | 115.578687 | 137.681711 |  1.50643 | 0.519626 | 0.066641 | 0.172808 | 0.616412 | 1.272732 | 0.350313 | 0.045285 | 0.045985 |  0.42365 | 0.593879 |
    | 04.01. |  0.0 |  9.578947 |   0.0 |   0.0 | 10.378947 | 0.032226 | 0.016113 |       0.0 |       0.0 |      0.0 | 0.015314 | 5.319577 | 5.319577 | 7.447408 | 2.176305 | 0.068841 |  0.20818 | 0.638409 | 2.176305 | 2.291794 |      0.0 |  77.236628 | 108.131279 | 142.022071 | 1.540506 |   0.6358 | 0.068841 |  0.20818 | 0.638409 | 1.318286 | 0.441685 | 0.046381 | 0.059765 | 0.425678 |  0.63661 |
    | 04.01. |  0.0 |  9.789474 |   0.0 |   0.0 | 10.589474 | 0.032385 | 0.016192 |       0.0 |       0.0 |      0.0 | 0.015492 | 5.427479 | 5.427479 | 7.598471 | 2.335218 | 0.071011 | 0.245165 |  0.66011 | 2.335218 | 2.457865 |      0.0 |  71.809148 | 100.532808 | 146.293546 | 1.571775 | 0.763444 | 0.071011 | 0.245165 |  0.66011 | 1.361496 | 0.545259 |  0.04753 | 0.075678 | 0.427903 |  0.68274 |
    | 04.01. |  0.0 |      10.0 |   0.0 |   0.0 |      10.8 | 0.032543 | 0.016271 |       0.0 |       0.0 |      0.0 | 0.015659 | 5.535382 | 5.535382 | 7.749534 | 2.503295 | 0.073147 |  0.28348 | 0.681468 | 2.503295 | 2.635806 |      0.0 |  66.273767 |  92.783273 | 150.486031 | 1.600527 | 0.902769 | 0.073147 |  0.28348 | 0.681468 | 1.402306 | 0.660793 | 0.048727 |  0.09366 |  0.43032 | 0.732168 |

    .. raw:: html

        <iframe
            src="lland_v1_ex6.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from lland
from hydpy.models.lland import lland_model
from hydpy.models.lland import lland_control
from hydpy.models.lland import lland_derived
from hydpy.models.lland import lland_inputs
from hydpy.models.lland import lland_fluxes
from hydpy.models.lland import lland_states
from hydpy.models.lland import lland_aides
from hydpy.models.lland import lland_outlets
from hydpy.models.lland.lland_constants import *


class Model(modeltools.Model):
    """LARSIM-Land version of HydPy-L-Land (lland_v1)."""
    _RUN_METHODS = (lland_model.calc_nkor_v1,
                    lland_model.calc_tkor_v1,
                    lland_model.calc_et0_v1,
                    lland_model.calc_evpo_v1,
                    lland_model.calc_nbes_inzp_v1,
                    lland_model.calc_evi_inzp_v1,
                    lland_model.calc_sbes_v1,
                    lland_model.calc_wgtf_v1,
                    lland_model.calc_schm_wats_v1,
                    lland_model.calc_wada_waes_v1,
                    lland_model.calc_evb_v1,
                    lland_model.calc_qbb_v1,
                    lland_model.calc_qib1_v1,
                    lland_model.calc_qib2_v1,
                    lland_model.calc_qdb_v1,
                    lland_model.calc_bowa_v1,
                    lland_model.calc_qbgz_v1,
                    lland_model.calc_qigz1_v1,
                    lland_model.calc_qigz2_v1,
                    lland_model.calc_qdgz_v1,
                    lland_model.calc_qdgz1_qdgz2_v1,
                    lland_model.calc_qbga_v1,
                    lland_model.calc_qiga1_v1,
                    lland_model.calc_qiga2_v1,
                    lland_model.calc_qdga1_v1,
                    lland_model.calc_qdga2_v1,
                    lland_model.calc_q_v1)
    _OUTLET_METHODS = (lland_model.pass_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of lland_v1, directly defined by the user."""
    _PARCLASSES = (lland_control.FT,
                   lland_control.NHRU,
                   lland_control.Lnk,
                   lland_control.FHRU,
                   lland_control.HNN,
                   lland_control.KG,
                   lland_control.KT,
                   lland_control.KE,
                   lland_control.KF,
                   lland_control.FLn,
                   lland_control.HInz,
                   lland_control.LAI,
                   lland_control.TRefT,
                   lland_control.TRefN,
                   lland_control.TGr,
                   lland_control.TSp,
                   lland_control.GTF,
                   lland_control.RSchmelz,
                   lland_control.CPWasser,
                   lland_control.PWMax,
                   lland_control.GrasRef_R,
                   lland_control.NFk,
                   lland_control.RelWZ,
                   lland_control.RelWB,
                   lland_control.Beta,
                   lland_control.FBeta,
                   lland_control.DMax,
                   lland_control.DMin,
                   lland_control.BSf,
                   lland_control.A1,
                   lland_control.A2,
                   lland_control.TInd,
                   lland_control.EQB,
                   lland_control.EQI1,
                   lland_control.EQI2,
                   lland_control.EQD1,
                   lland_control.EQD2,
                   lland_control.NegQ)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of lland_v1, indirectly defined by the user."""
    _PARCLASSES = (lland_derived.MOY,
                   lland_derived.KInz,
                   lland_derived.WB,
                   lland_derived.WZ,
                   lland_derived.KB,
                   lland_derived.KI1,
                   lland_derived.KI2,
                   lland_derived.KD1,
                   lland_derived.KD2,
                   lland_derived.QFactor)


class InputSequences(sequencetools.InputSequences):
    """Input sequences of lland_v1."""
    _SEQCLASSES = (lland_inputs.Nied,
                   lland_inputs.TemL,
                   lland_inputs.Glob)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of lland_v1."""
    _SEQCLASSES = (lland_fluxes.NKor,
                   lland_fluxes.TKor,
                   lland_fluxes.ET0,
                   lland_fluxes.EvPo,
                   lland_fluxes.NBes,
                   lland_fluxes.SBes,
                   lland_fluxes.EvI,
                   lland_fluxes.EvB,
                   lland_fluxes.WGTF,
                   lland_fluxes.Schm,
                   lland_fluxes.WaDa,
                   lland_fluxes.QDB,
                   lland_fluxes.QIB1,
                   lland_fluxes.QIB2,
                   lland_fluxes.QBB,
                   lland_fluxes.QDGZ,
                   lland_fluxes.Q)


class StateSequences(sequencetools.StateSequences):
    """State sequences of lland_v1."""
    _SEQCLASSES = (lland_states.Inzp,
                   lland_states.WATS,
                   lland_states.WAeS,
                   lland_states.BoWa,
                   lland_states.QDGZ1,
                   lland_states.QDGZ2,
                   lland_states.QIGZ1,
                   lland_states.QIGZ2,
                   lland_states.QBGZ,
                   lland_states.QDGA1,
                   lland_states.QDGA2,
                   lland_states.QIGA1,
                   lland_states.QIGA2,
                   lland_states.QBGA)


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of lland_v1."""
    _SEQCLASSES = (lland_aides.SfA,
                   lland_aides.Exz,
                   lland_aides.BVl,
                   lland_aides.MVl,
                   lland_aides.RVl,
                   lland_aides.EPW)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of lland_v1."""
    _SEQCLASSES = (lland_outlets.Q,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland_v2.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""
Version 2 of the L-Land model |lland_v2| is a slight modification of
|lland_v1|.  |lland_v1| implements a specific equation for the calculation
of reference evaporation (|ET0|) for each hydrological response unit (HRU).
In contrast, |lland_v2| expects subbasin wide potential evaporation values
(|PET|) to be calculated externally and adjusts them to the different HRUs
of the subbasin.

|lland_v1| should be applied on daily step sized only due to the restrictions
of the Turc-Wendling equation for calculating reference evaporation.
Instead, |lland_v2| can be applied on arbitrary simulation step sizes.

Integration tests:

    The following integration tests are mostly recalculations of the ones
    performed for |lland_v1| in order to show that both models function
    in an equal manner.  Hence, most configurations are identical.
    One exception is that |lland_v2| requires no global radiation input
    (|Glob|).  Instead, potential evaporation needs (|PET|) to be defined,
    which is taken from the integration tests results of model |lland_v1|
    to achieve comparability.  Another exception is that |lland_v1| allows
    to smooth calculated |ET0| values over time, which is discussed below.

    The following general setup is identical with the one of |lland_v1|:

    >>> from hydpy import pub, Timegrid, Timegrids
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000',
    ...                                    '05.01.2000',
    ...                                    '1h'))
    >>> from hydpy.models.lland_v2 import *
    >>> parameterstep('1h')
    >>> from hydpy import Node, Element
    >>> outlet = Node('outlet')
    >>> land = Element('land', outlets=outlet)
    >>> land.connect(model)
    >>> nhru(1)
    >>> ft(1.0)
    >>> fhru(1.0)
    >>> from hydpy import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 800
    >>> IntegrationTest.plotting_options.activated=(
    ...     inputs.nied, inputs.teml, fluxes.q)
    >>> test = IntegrationTest(land)
    >>> test.dateformat = '%d.%m.'

    .. _lland_v2_ex1:

    :ref:`Recalculation of example 1 <lland_v1_ex1>`

    The following parameter and initial condition values are identical with
    the ones of |lland_v1|, except that the Turc-Wendling related parameter
    |KF| is missing:

    >>> lnk(ACKER)
    >>> kg(1.2)
    >>> kt(0.8)
    >>> ke(0.4)
    >>> wfet0(1.0)
    >>> fln(0.5)
    >>> hinz(0.2)
    >>> lai(4.0)
    >>> treft(0.0)
    >>> trefn(0.0)
    >>> tgr(1.0)
    >>> tsp(2.0)
    >>> gtf(0.5)
    >>> rschmelz(334.0)
    >>> cpwasser(4.1868)
    >>> pwmax(1.4)
    >>> grasref_r(5.0)
    >>> nfk(200.0)
    >>> relwz(0.5)
    >>> relwb(0.05)
    >>> beta(0.005)
    >>> fbeta(1.0)
    >>> dmax(1.0)
    >>> dmin(0.1)
    >>> bsf(0.4)
    >>> a1(1.0)
    >>> a2(1.0)
    >>> tind(1.0)
    >>> eqb(100.0)
    >>> eqi1(20.0)
    >>> eqi2(10.0)
    >>> eqd1(5.0)
    >>> eqd2(2.0)
    >>> negq(False)
    >>> test.inits = ((states.inzp, 0.0),
    ...               (states.wats, 0.0),
    ...               (states.waes, 0.0),
    ...               (states.bowa, 100.0),
    ...               (states.qdgz1, 0.0),
    ...               (states.qdgz2, 0.0),
    ...               (states.qigz1, 0.0),
    ...               (states.qigz2, 0.0),
    ...               (states.qbgz, 0.5),
    ...               (states.qdga1, 0.0),
    ...               (states.qdga2, 0.0),
    ...               (states.qiga1, 0.0),
    ...               (states.qiga2, 0.0),
    ...               (states.qbga, 0.5),
    ...               (logs.wet0, 0.0))

    The values of the input sequences of |Nied| (precipitation) and |TemL|
    (air temperature) are also taken from the input data of the example on
    |lland_v1|.  But the values of |PET| (potential evaporation) are taken
    from the output data of |lland_v1| (divided by 0.4 to account for the
    set value of the evaporation adjustment factor |KE|):

    >>> inputs.nied.series = (
    ...     0.0, 0.0,  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 0.2, 0.0, 0.0, 1.3, 5.6, 2.9, 4.9, 10.6, 0.1, 0.7, 3.0,
    ...     2.1, 10.4, 3.5, 3.4, 1.2, 0.1, 0.0, 0.0, 0.4, 0.1, 3.6, 5.9, 1.1,
    ...     20.7, 37.9, 8.2, 3.6, 7.5, 18.5, 15.4, 6.3, 1.9, 4.9, 2.7, 0.5,
    ...     0.2, 0.5, 2.4, 0.4, 0.2, 0.0, 0.0, 0.3, 2.6, 0.7, 0.3, 0.3, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.3, 0.0,
    ...     0.0, 0.0, 0.7, 0.4, 0.1, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
    ...     0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    >>> inputs.teml.series = (
    ...     21.2, 19.4, 18.9, 18.3, 18.9, 22.5, 25.1, 28.3, 27.8, 31.4, 32.2,
    ...     35.2, 37.1, 31.2, 24.3, 25.4, 25.9, 23.7, 21.6, 21.2, 20.4, 19.8,
    ...     19.6, 19.2, 19.2, 19.2, 18.9, 18.7, 18.5, 18.3, 18.5, 18.8, 18.8,
    ...     19.0, 19.2, 19.3, 19.0, 18.8, 18.7, 17.8, 17.4, 17.3, 16.8, 16.5,
    ...     16.3, 16.2, 15.5, 14.6, 14.7, 14.6, 14.1, 14.3, 14.9, 15.7, 16.0,
    ...     16.7, 17.1, 16.2, 15.9, 16.3, 16.3, 16.4, 16.5, 18.4, 18.3, 18.1,
    ...     16.7, 15.2, 13.4, 12.4, 11.6, 11.0, 10.5, 11.7, 11.9, 11.2, 11.1,
    ...     11.9, 12.2, 11.8, 11.4, 11.6, 13.0, 17.1, 18.2, 22.4, 21.4, 21.8,
    ...     22.2, 20.1, 17.8, 15.2, 14.5, 12.4, 11.7, 11.9)
    >>> inputs.pet.series = (
    ...     0.100707, 0.097801, 0.096981, 0.09599, 0.096981, 0.102761,
    ...     0.291908, 1.932875, 4.369536, 7.317556, 8.264362, 9.369867,
    ...     5.126178, 6.62503, 7.397619, 2.39151, 1.829834, 1.136569,
    ...     0.750986, 0.223895, 0.099425, 0.098454, 0.098128, 0.097474,
    ...     0.097474, 0.097474, 0.096981, 0.096652, 0.096321, 0.09599,
    ...     0.187298, 1.264612, 3.045538, 1.930758, 2.461001, 6.215945,
    ...     3.374783, 8.821555, 4.046025, 2.110757, 2.239257, 2.877848,
    ...     1.591452, 0.291604, 0.092622, 0.092451, 0.091248, 0.089683,
    ...     0.089858, 0.089683, 0.088805, 0.089157, 0.090207, 0.091593,
    ...     0.154861, 0.470369, 1.173726, 4.202296, 4.359715, 5.305753,
    ...     5.376027, 4.658915, 7.789594, 4.851567, 5.30692, 3.286036,
    ...     1.506216, 0.274762, 0.087565, 0.085771, 0.084317, 0.083215,
    ...     0.082289, 0.0845, 0.084864, 0.083584, 0.0834, 0.084864, 0.310229,
    ...     1.391958, 3.195876, 5.191651, 7.155036, 8.391432, 8.391286,
    ...     10.715238, 9.383394, 7.861915, 6.298329, 2.948416, 1.309232,
    ...     0.32955, 0.089508, 0.085771, 0.0845, 0.084864)


    The following calculation shows, that the outflow values of the
    integration test for arable land (|ACKER|) are reproduced exactly:

    >>> test('lland_v2_ex1')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo |      nbes | sbes |      evi |      evb |      wgtf | schm |      wada |       qdb |     qib1 |     qib2 |      qbb |      qdgz |        q |     inzp | wats | waes |       bowa |    qdgz1 |     qdgz2 |    qigz1 |    qigz2 |     qbgz |    qdga1 |    qdga2 |    qiga1 |    qiga2 |     qbga |   outlet |
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.040283 | 0.020141 |       0.0 |  0.0 |      0.0 | 0.017301 | 11.275777 |  0.0 |       0.0 |       0.0 |     0.05 |      0.0 |     0.45 |       0.0 |  0.50098 |      0.0 |  0.0 |  0.0 |  99.482699 |      0.0 |       0.0 |     0.05 |      0.0 |     0.45 |      0.0 |      0.0 | 0.001229 |      0.0 | 0.499751 | 0.139161 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.03912 |  0.01956 |       0.0 |  0.0 |      0.0 | 0.016766 | 10.353214 |  0.0 |       0.0 |       0.0 | 0.049741 |      0.0 | 0.447413 |       0.0 | 0.502845 |      0.0 |  0.0 |  0.0 |  98.968779 |      0.0 |       0.0 | 0.049741 |      0.0 | 0.447413 |      0.0 |      0.0 | 0.003602 |      0.0 | 0.499243 | 0.139679 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.016589 | 10.096946 |  0.0 |       0.0 |       0.0 | 0.049484 |      0.0 | 0.444844 |       0.0 |  0.50456 |      0.0 |  0.0 |  0.0 |  98.457861 |      0.0 |       0.0 | 0.049484 |      0.0 | 0.444844 |      0.0 |      0.0 | 0.005846 |      0.0 | 0.498714 | 0.140156 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.038396 | 0.019198 |       0.0 |  0.0 |      0.0 | 0.016383 |  9.789425 |  0.0 |       0.0 |       0.0 | 0.049229 |      0.0 | 0.442289 |       0.0 | 0.506133 |      0.0 |  0.0 |  0.0 |   97.94996 |      0.0 |       0.0 | 0.049229 |      0.0 | 0.442289 |      0.0 |      0.0 | 0.007968 |      0.0 | 0.498166 | 0.140593 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.016516 | 10.096946 |  0.0 |       0.0 |       0.0 | 0.048975 |      0.0 |  0.43975 |       0.0 | 0.507571 |      0.0 |  0.0 |  0.0 |  97.444719 |      0.0 |       0.0 | 0.048975 |      0.0 |  0.43975 |      0.0 |      0.0 | 0.009974 |      0.0 | 0.497597 | 0.140992 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.041104 | 0.020552 |       0.0 |  0.0 |      0.0 | 0.017461 | 11.942073 |  0.0 |       0.0 |       0.0 | 0.048722 |      0.0 | 0.437224 |       0.0 | 0.508878 |      0.0 |  0.0 |  0.0 |  96.941312 |      0.0 |       0.0 | 0.048722 |      0.0 | 0.437224 |      0.0 |      0.0 |  0.01187 |      0.0 | 0.497009 | 0.141355 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.116763 | 0.058382 |       0.0 |  0.0 |      0.0 |  0.04949 | 13.274665 |  0.0 |       0.0 |       0.0 | 0.048471 |      0.0 | 0.434707 |       0.0 | 0.510062 |      0.0 |  0.0 |  0.0 |  96.408645 |      0.0 |       0.0 | 0.048471 |      0.0 | 0.434707 |      0.0 |      0.0 | 0.013661 |      0.0 | 0.496401 | 0.141684 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 |  0.77315 | 0.386575 |       0.0 |  0.0 |      0.0 | 0.326912 | 14.914778 |  0.0 |       0.0 |       0.0 | 0.048204 |      0.0 | 0.432043 |       0.0 | 0.511126 |      0.0 |  0.0 |  0.0 |  95.601485 |      0.0 |       0.0 | 0.048204 |      0.0 | 0.432043 |      0.0 |      0.0 | 0.015352 |      0.0 | 0.495774 | 0.141979 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 1.747814 | 0.873907 |       0.0 |  0.0 |      0.0 | 0.736293 |  14.65851 |  0.0 |       0.0 |       0.0 | 0.047801 |      0.0 | 0.428007 |       0.0 | 0.512064 |      0.0 |  0.0 |  0.0 |  94.389384 |      0.0 |       0.0 | 0.047801 |      0.0 | 0.428007 |      0.0 |      0.0 | 0.016944 |      0.0 |  0.49512 |  0.14224 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 2.927022 | 1.463511 |       0.0 |  0.0 |      0.0 | 1.226019 | 16.503638 |  0.0 |       0.0 |       0.0 | 0.047195 |      0.0 | 0.421947 |       0.0 | 0.512856 |      0.0 |  0.0 |  0.0 |  92.694223 |      0.0 |       0.0 | 0.047195 |      0.0 | 0.421947 |      0.0 |      0.0 | 0.018434 |      0.0 | 0.494422 |  0.14246 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 3.305745 | 1.652872 |       0.0 |  0.0 |      0.0 | 1.373207 | 16.913666 |  0.0 |       0.0 |       0.0 | 0.046347 |      0.0 | 0.413471 |       0.0 | 0.513475 |      0.0 |  0.0 |  0.0 |  90.861198 |      0.0 |       0.0 | 0.046347 |      0.0 | 0.413471 |      0.0 |      0.0 | 0.019816 |      0.0 | 0.493659 | 0.142632 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 3.747947 | 1.873973 |       0.0 |  0.0 |      0.0 |  1.54235 | 18.451272 |  0.0 |       0.0 |       0.0 | 0.045431 |      0.0 | 0.404306 |       0.0 | 0.513903 |      0.0 |  0.0 |  0.0 |  88.869112 |      0.0 |       0.0 | 0.045431 |      0.0 | 0.404306 |      0.0 |      0.0 | 0.021087 |      0.0 | 0.492815 | 0.142751 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 2.050471 | 1.025236 |       0.0 |  0.0 |      0.0 | 0.834816 | 19.425089 |  0.0 |       0.0 |       0.0 | 0.044435 |      0.0 | 0.394346 |       0.0 | 0.514135 |      0.0 |  0.0 |  0.0 |  87.595516 |      0.0 |       0.0 | 0.044435 |      0.0 | 0.394346 |      0.0 |      0.0 |  0.02225 |      0.0 | 0.491885 | 0.142815 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 2.650012 | 1.325006 |       0.0 |  0.0 |      0.0 | 1.071233 | 16.401131 |  0.0 |       0.0 |       0.0 | 0.043798 |      0.0 | 0.387978 |       0.0 | 0.514199 |      0.0 |  0.0 |  0.0 |  86.092508 |      0.0 |       0.0 | 0.043798 |      0.0 | 0.387978 |      0.0 |      0.0 | 0.023316 |      0.0 | 0.490883 | 0.142833 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 2.959048 | 1.479524 |       0.0 |  0.0 |      0.0 | 1.185757 | 12.864637 |  0.0 |       0.0 |       0.0 | 0.043046 |      0.0 | 0.380463 |       0.0 | 0.514118 |      0.0 |  0.0 |  0.0 |  84.483242 |      0.0 |       0.0 | 0.043046 |      0.0 | 0.380463 |      0.0 |      0.0 | 0.024297 |      0.0 | 0.489821 | 0.142811 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 0.956604 | 0.478302 |       0.0 |  0.0 |     0.24 | 0.189137 | 13.428426 |  0.0 |       0.0 |       0.0 | 0.042242 |      0.0 | 0.372416 |       0.0 | 0.513884 |      0.0 |  0.0 |  0.0 |  83.879448 |      0.0 |       0.0 | 0.042242 |      0.0 | 0.372416 |      0.0 |      0.0 | 0.025191 |      0.0 | 0.488693 | 0.142746 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 0.731934 | 0.365967 |       0.0 |  0.0 |      0.0 | 0.289374 | 13.684693 |  0.0 |       0.0 |       0.0 |  0.04194 |      0.0 | 0.369397 |       0.0 | 0.513537 |      0.0 |  0.0 |  0.0 |  83.178737 |      0.0 |       0.0 |  0.04194 |      0.0 | 0.369397 |      0.0 |      0.0 | 0.026016 |      0.0 | 0.487521 | 0.142649 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 0.454628 | 0.227314 |       0.0 |  0.0 |      0.0 | 0.178944 | 12.557116 |  0.0 |       0.0 |       0.0 | 0.041589 |      0.0 | 0.365894 |       0.0 | 0.513112 |      0.0 |  0.0 |  0.0 |   82.59231 |      0.0 |       0.0 | 0.041589 |      0.0 | 0.365894 |      0.0 |      0.0 | 0.026784 |      0.0 | 0.486328 | 0.142531 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 0.300394 | 0.150197 |      0.76 |  0.0 | 0.150197 |      0.0 | 11.480791 |  0.0 |      0.76 |  0.107812 | 0.041296 |      0.0 | 0.362962 |  0.107812 | 0.522711 | 0.649803 |  0.0 |  0.0 |   82.84024 | 0.107812 |       0.0 | 0.041296 |      0.0 | 0.362962 | 0.010097 |      0.0 | 0.027498 |      0.0 | 0.485115 | 0.145197 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 0.089558 | 0.044779 |  6.569803 |  0.0 | 0.044779 |      0.0 | 11.275777 |  0.0 |  6.569803 |   0.96994 |  0.04142 |      0.0 | 0.364201 |   0.96994 | 0.620632 | 0.755221 |  0.0 |  0.0 |  88.034482 |  0.96994 |       0.0 |  0.04142 |      0.0 | 0.364201 | 0.108551 |      0.0 | 0.028174 |      0.0 | 0.483906 | 0.172398 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 |  0.03977 | 0.019885 |  3.435221 |  0.0 | 0.019885 |      0.0 | 10.865749 |  0.0 |  3.435221 |  0.535552 | 0.044017 |      0.0 | 0.390172 |  0.535552 | 0.735741 | 0.780115 |  0.0 |  0.0 |  90.499961 | 0.535552 |       0.0 | 0.044017 |      0.0 | 0.390172 | 0.224012 |      0.0 | 0.028884 |      0.0 | 0.482844 | 0.204372 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 | 0.039382 | 0.019691 |  5.860115 |  0.0 | 0.019691 |      0.0 | 10.558228 |  0.0 |  5.860115 |  0.958535 |  0.04525 |      0.0 |   0.4025 |  0.958535 | 0.831735 | 0.780309 |  0.0 |  0.0 |  94.953791 | 0.958535 |       0.0 |  0.04525 |      0.0 |   0.4025 | 0.320099 |      0.0 | 0.029653 |      0.0 | 0.481984 | 0.231038 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 0.039251 | 0.019626 | 12.700309 |  0.0 | 0.019626 |      0.0 | 10.455721 |  0.0 | 12.700309 |  2.288291 | 0.047477 |      0.0 | 0.424769 |  2.288291 | 1.158742 | 0.780374 |  0.0 |  0.0 | 104.893563 | 1.562993 |  0.725298 | 0.047477 |      0.0 | 0.424769 | 0.492438 | 0.154533 | 0.030468 |      0.0 | 0.481304 | 0.321873 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.100374 |  0.0 | 0.019495 |      0.0 | 10.250707 |  0.0 |  0.100374 |  0.019216 | 0.052447 | 0.009743 | 0.474468 |  0.019216 | 1.279374 | 0.780505 |  0.0 |  0.0 | 104.438065 | 0.019216 |       0.0 | 0.052447 | 0.009743 | 0.474468 | 0.541916 | 0.224579 |  0.03142 | 0.000471 | 0.480989 | 0.355382 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.820505 |  0.0 | 0.019495 |      0.0 | 10.250707 |  0.0 |  0.820505 |   0.15675 | 0.052219 | 0.008415 |  0.47219 |   0.15675 | 1.110902 | 0.780505 |  0.0 |  0.0 | 104.568996 |  0.15675 |       0.0 | 0.052219 | 0.008415 |  0.47219 | 0.460047 | 0.136214 |  0.03244 | 0.001289 | 0.480913 | 0.308584 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 |  0.03899 | 0.019495 |  3.580505 |  0.0 | 0.019495 |      0.0 | 10.250707 |  0.0 |  3.580505 |  0.694905 | 0.052284 |  0.00879 | 0.472845 |  0.694905 | 1.054307 | 0.780505 |  0.0 |  0.0 | 106.920677 | 0.694905 |       0.0 | 0.052284 |  0.00879 | 0.472845 | 0.455469 | 0.082618 | 0.033406 | 0.001986 | 0.480829 | 0.292863 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.038792 | 0.019396 |  2.500505 |  0.0 | 0.019396 |      0.0 | 10.096946 |  0.0 |  2.500505 |  0.497074 |  0.05346 | 0.016386 | 0.484603 |  0.497074 | 1.048618 | 0.780604 |  0.0 |  0.0 | 108.369658 | 0.497074 |       0.0 |  0.05346 | 0.016386 | 0.484603 | 0.480344 |  0.05011 | 0.034356 |    0.003 | 0.480808 | 0.291283 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 | 0.038661 |  0.01933 | 12.460604 |  0.0 |  0.01933 |      0.0 |  9.994439 |  0.0 | 12.460604 |  2.648297 | 0.054185 | 0.021792 | 0.491848 |  2.648297 | 1.358463 |  0.78067 |  0.0 |  0.0 | 117.614139 | 1.622399 |  1.025898 | 0.054185 | 0.021792 | 0.491848 | 0.588767 | 0.248973 | 0.035305 | 0.004536 | 0.480882 | 0.377351 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.038528 | 0.019264 |   4.18067 |  0.0 | 0.019264 |      0.0 |  9.891932 |  0.0 |   4.18067 |  0.954177 | 0.058807 | 0.066533 | 0.538071 |  0.954177 | 1.575545 | 0.780736 |  0.0 |  0.0 | 120.177222 | 0.954177 |       0.0 | 0.058807 | 0.066533 | 0.538071 | 0.713551 |  0.33609 |  0.03634 | 0.008342 | 0.481222 | 0.437651 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.038396 | 0.019198 |  4.060736 |  0.0 | 0.019198 |      0.0 |  9.789425 |  0.0 |  4.060736 |   0.95486 | 0.060089 | 0.081571 | 0.550886 |   0.95486 | 1.495007 | 0.780802 |  0.0 |  0.0 | 122.590552 |  0.95486 |       0.0 | 0.060089 | 0.081571 | 0.550886 | 0.757233 | 0.203849 | 0.037467 | 0.014607 | 0.481851 |  0.41528 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.074919 |  0.03746 |  1.420802 |  0.0 |  0.03746 |      0.0 |  9.891932 |  0.0 |  1.420802 |  0.339664 | 0.061295 | 0.096635 | 0.562953 |  0.339664 | 1.401988 |  0.76254 |  0.0 |  0.0 | 122.950807 | 0.339664 |       0.0 | 0.061295 | 0.096635 | 0.562953 | 0.735442 | 0.123641 |   0.0386 | 0.021708 | 0.482598 | 0.389441 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.505845 | 0.252922 |   0.08254 |  0.0 | 0.252922 |      0.0 | 10.045692 |  0.0 |   0.08254 |  0.019698 | 0.061475 | 0.098955 | 0.564754 |  0.019698 | 1.260794 | 0.547078 |  0.0 |  0.0 | 122.288465 | 0.019698 |       0.0 | 0.061475 | 0.098955 | 0.564754 | 0.633733 | 0.074992 | 0.039711 | 0.028951 | 0.483407 |  0.35022 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 | 1.218215 | 0.609108 |       0.0 |  0.0 | 0.547078 | 0.057195 | 10.045692 |  0.0 |       0.0 |       0.0 | 0.061144 | 0.094703 | 0.561442 |       0.0 | 1.126438 |      0.0 |  0.0 |  0.0 | 121.513981 |      0.0 |       0.0 | 0.061144 | 0.094703 | 0.561442 | 0.520583 | 0.045485 | 0.040764 | 0.035407 |   0.4842 |   0.3129 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.772303 | 0.386152 |       0.0 |  0.0 |      0.0 | 0.355393 |   10.1482 |  0.0 |       0.0 |       0.0 | 0.060757 |  0.08981 |  0.55757 |       0.0 | 1.021316 |      0.0 |  0.0 |  0.0 | 120.450451 |      0.0 |       0.0 | 0.060757 |  0.08981 |  0.55757 | 0.426217 | 0.027588 | 0.041749 | 0.040813 | 0.484949 | 0.283699 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 |   0.9844 |   0.4922 |       0.0 |  0.0 |     0.48 | 0.011199 | 10.250707 |  0.0 |       0.0 |       0.0 | 0.060225 | 0.083233 | 0.552252 |       0.0 | 0.939155 |      0.0 |  0.0 |  0.0 | 119.743542 |      0.0 |       0.0 | 0.060225 | 0.083233 | 0.552252 | 0.348957 | 0.016733 | 0.042663 | 0.045158 | 0.485645 | 0.260876 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 2.486378 | 1.243189 |       0.0 |  0.0 |     0.12 | 1.029208 |  10.30196 |  0.0 |       0.0 |       0.0 | 0.059872 | 0.078955 | 0.548718 |       0.0 | 0.874225 |      0.0 |  0.0 |  0.0 | 118.026789 |      0.0 |       0.0 | 0.059872 | 0.078955 | 0.548718 | 0.285702 | 0.010149 | 0.043511 | 0.048574 |  0.48629 |  0.24284 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 | 1.349913 | 0.674957 |      3.52 |  0.0 | 0.674957 |      0.0 |   10.1482 |  0.0 |      3.52 |  0.804879 | 0.059013 | 0.068884 | 0.540134 |  0.804879 | 0.897582 | 0.125043 |  0.0 |  0.0 | 120.073879 | 0.804879 |       0.0 | 0.059013 | 0.068884 | 0.540134 | 0.309293 | 0.006156 | 0.044287 | 0.050978 | 0.486868 | 0.249328 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 3.528622 | 1.764311 |  6.405043 |  0.0 |      0.8 | 0.884359 | 10.045692 |  0.0 |  6.405043 |  1.520398 | 0.060037 | 0.080945 | 0.550369 |  1.520398 | 1.076887 |      0.0 |  0.0 |  0.0 | 123.382815 | 1.342277 |   0.17812 | 0.060037 | 0.080945 | 0.550369 | 0.449457 | 0.041684 | 0.045031 | 0.053265 | 0.487449 | 0.299135 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 |  1.61841 | 0.809205 |      0.52 |  0.0 |      0.8 | 0.008509 |  9.994439 |  0.0 |      0.52 |  0.124975 | 0.061691 | 0.101762 | 0.566914 |  0.124975 | 1.145578 |      0.0 |  0.0 |  0.0 | 123.038963 | 0.124975 |       0.0 | 0.061691 | 0.101762 | 0.566914 | 0.497293 | 0.057417 | 0.045803 | 0.056906 | 0.488158 | 0.318216 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.844303 | 0.422151 |     24.04 |  0.0 | 0.422151 |      0.0 |  9.533157 |  0.0 |     24.04 |  6.385076 | 0.061519 | 0.099526 | 0.565195 |  6.385076 | 2.189796 | 0.377849 |  0.0 |  0.0 | 139.967647 | 1.843385 |  4.541691 | 0.061519 | 0.099526 | 0.565195 | 0.590738 | 1.002484 | 0.046574 | 0.061067 | 0.488933 | 0.608277 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.895703 | 0.447851 | 45.057849 |  0.0 | 0.447851 |      0.0 |  9.328143 |  0.0 | 45.057849 | 15.758715 | 0.069984 | 0.227408 | 0.649838 | 15.758715 | 5.807432 | 0.352149 |  0.0 |  0.0 |  168.31955 | 1.936543 | 13.822172 | 0.069984 | 0.227408 | 0.649838 | 0.826529 | 4.372365 | 0.047511 | 0.070913 | 0.490114 | 1.613176 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 1.151139 |  0.57557 |  9.392149 |  0.0 |  0.57557 |      0.0 |  9.276889 |  0.0 |  9.392149 |   3.98674 |  0.08416 |  0.50823 | 0.791598 |   3.98674 | 7.273291 |  0.22443 |  0.0 |  0.0 | 172.340972 | 1.749168 |  2.237571 |  0.08416 |  0.50823 | 0.791598 | 1.010192 | 5.622344 | 0.048956 |  0.09939 | 0.492409 | 2.020359 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.636581 |  0.31829 |   3.74443 |  0.0 |  0.31829 |      0.0 |  9.020622 |  0.0 |   3.74443 |  1.640415 |  0.08617 | 0.553757 | 0.811705 |  1.640415 | 5.664322 |  0.48171 |  0.0 |  0.0 | 172.993355 | 1.390398 |  0.250017 |  0.08617 | 0.553757 | 0.811705 | 1.110546 | 3.867069 | 0.050722 | 0.140498 | 0.495487 | 1.573423 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.116642 | 0.058321 |   8.68171 |  0.0 | 0.058321 |      0.0 |  8.866861 |  0.0 |   8.68171 |  3.912578 | 0.086497 | 0.561264 | 0.814967 |  3.912578 | 4.778279 | 0.741679 |  0.0 |  0.0 | 176.299758 | 1.744414 |  2.168164 | 0.086497 | 0.561264 | 0.814967 | 1.194429 | 2.852553 | 0.052459 | 0.180188 | 0.498649 |   1.3273 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.037049 | 0.018524 | 22.141679 |  0.0 | 0.018524 |      0.0 |  8.764354 |  0.0 | 22.141679 | 11.051854 |  0.08815 | 0.599829 | 0.831499 | 11.051854 | 6.153137 | 0.781476 |  0.0 |  0.0 | 185.870106 | 1.909517 |  9.142336 |  0.08815 | 0.599829 | 0.831499 | 1.309587 | 4.069193 |  0.05416 | 0.218318 | 0.501879 | 1.709205 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 |  0.03698 |  0.01849 | 18.461476 |  0.0 |  0.01849 |      0.0 |  8.713101 |  0.0 | 18.461476 | 10.642573 | 0.092935 | 0.716152 | 0.879351 | 10.642573 | 8.218452 |  0.78151 |  0.0 |  0.0 |  192.00057 | 1.906038 |  8.736535 | 0.092935 | 0.716152 | 0.879351 |  1.41801 | 5.978859 | 0.055935 | 0.260251 | 0.505397 | 2.282903 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.036499 |  0.01825 |   7.54151 |  0.0 |  0.01825 |      0.0 |  8.354326 |  0.0 |   7.54151 |  4.706328 |    0.096 | 0.794197 | 0.910003 |  4.706328 | 8.194259 |  0.78175 |  0.0 |  0.0 | 193.035552 |  1.78752 |  2.918807 |    0.096 | 0.794197 | 0.910003 | 1.495375 | 5.824387 | 0.057815 | 0.307411 | 0.509271 | 2.276183 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.035873 | 0.017937 |   2.26175 |  0.0 | 0.017937 |      0.0 |  7.893044 |  0.0 |   2.26175 |  1.410813 | 0.096518 | 0.807636 | 0.915178 |  1.410813 |  6.51394 | 0.782063 |  0.0 |  0.0 | 192.067158 | 1.291189 |  0.119624 | 0.096518 | 0.807636 | 0.915178 | 1.501849 | 4.084733 |  0.05969 | 0.354385 | 0.513284 | 1.809428 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.035943 | 0.017972 |  5.862063 |  0.0 | 0.017972 |      0.0 |  7.944298 |  0.0 |  5.862063 |   3.63316 | 0.096034 | 0.795059 | 0.910336 |   3.63316 | 5.385613 | 0.782028 |  0.0 |  0.0 | 192.494632 | 1.724758 |  1.908403 | 0.096034 | 0.795059 | 0.910336 | 1.504268 | 2.905704 | 0.061474 | 0.396909 | 0.517259 | 1.496004 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.035873 | 0.017937 |  3.222028 |  0.0 | 0.017937 |      0.0 |  7.893044 |  0.0 |  3.222028 |  1.991828 | 0.096247 | 0.800603 | 0.912473 |  1.991828 | 4.754322 | 0.782063 |  0.0 |  0.0 | 191.915509 | 1.497949 |   0.49388 | 0.096247 | 0.800603 | 0.912473 | 1.522994 | 2.211916 | 0.063165 | 0.435066 | 0.521181 | 1.320645 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.582063 |  0.0 | 0.017761 |      0.0 |  7.636776 |  0.0 |  0.582063 |  0.350289 | 0.095958 | 0.793096 | 0.909578 |  0.350289 | 3.900986 | 0.782239 |  0.0 |  0.0 | 190.348652 | 0.350289 |       0.0 | 0.095958 | 0.793096 | 0.909578 | 1.410972 | 1.430695 | 0.064771 | 0.469488 |  0.52506 | 1.083607 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.222239 |  0.0 | 0.017831 |      0.0 |  7.739283 |  0.0 |  0.222239 |  0.128894 | 0.095174 | 0.772903 | 0.901743 |  0.128894 | 3.160155 | 0.782169 |  0.0 |  0.0 | 188.672176 | 0.128894 |       0.0 | 0.095174 | 0.772903 | 0.901743 | 1.197968 |  0.86776 | 0.066273 | 0.499307 | 0.528847 | 0.877821 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.582169 |  0.0 | 0.018041 |      0.0 |  8.046805 |  0.0 |  0.582169 |  0.326672 | 0.094336 | 0.751491 | 0.893361 |  0.326672 | 2.673508 | 0.781959 |  0.0 |  0.0 | 187.188486 | 0.326672 |       0.0 | 0.094336 | 0.751491 | 0.893361 |   1.0227 | 0.526323 | 0.067662 | 0.524307 | 0.532515 | 0.742641 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.036637 | 0.018319 |  2.861959 |  0.0 | 0.018319 |      0.0 |  8.456833 |  0.0 |  2.861959 |   1.57602 | 0.093594 | 0.732708 | 0.885942 |   1.57602 | 2.507939 | 0.781681 |  0.0 |  0.0 | 186.762179 |  1.36549 |   0.21053 | 0.093594 | 0.732708 | 0.885942 | 0.993821 | 0.364087 | 0.068944 | 0.545018 | 0.536069 |  0.69665 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.061944 | 0.030972 |  0.461681 |  0.0 | 0.030972 |      0.0 |  8.610594 |  0.0 |  0.461681 |  0.249638 | 0.093381 | 0.727341 | 0.883811 |  0.249638 | 2.387801 | 0.769028 |  0.0 |  0.0 | 185.269689 | 0.249638 |       0.0 | 0.093381 | 0.727341 | 0.883811 |  0.95669 | 0.258811 | 0.070141 |  0.56262 | 0.539539 | 0.663278 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.209028 |  0.0 | 0.094074 |      0.0 |  8.969368 |  0.0 |  0.209028 |  0.109916 | 0.092635 | 0.708654 | 0.876348 |  0.109916 |  2.16399 | 0.705926 |  0.0 |  0.0 | 183.691162 | 0.109916 |       0.0 | 0.092635 | 0.708654 | 0.876348 | 0.815437 | 0.156977 | 0.071256 | 0.577391 | 0.542928 | 0.601108 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.46949 | 0.234745 |       0.0 |  0.0 | 0.234745 |      0.0 |  9.174382 |  0.0 |       0.0 |       0.0 | 0.091846 | 0.689068 | 0.868456 |       0.0 | 1.979886 | 0.471181 |  0.0 |  0.0 | 182.041793 |      0.0 |       0.0 | 0.091846 | 0.689068 | 0.868456 | 0.677254 | 0.095211 |  0.07228 | 0.588935 | 0.546206 | 0.549968 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 1.680918 | 0.840459 |       0.0 |  0.0 | 0.471181 |  0.36645 |  8.713101 |  0.0 |       0.0 |       0.0 | 0.091021 | 0.668798 | 0.860209 |       0.0 | 1.832306 |      0.0 |  0.0 |  0.0 | 180.055315 |      0.0 |       0.0 | 0.091021 | 0.668798 | 0.860209 | 0.554489 | 0.057749 | 0.073214 | 0.597483 | 0.549371 | 0.508974 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 1.743886 | 0.871943 |       0.0 |  0.0 |     0.36 | 0.507473 |   8.55934 |  0.0 |       0.0 |       0.0 | 0.090028 | 0.644656 | 0.850277 |       0.0 | 1.718578 |      0.0 |  0.0 |  0.0 | 177.962883 |      0.0 |       0.0 | 0.090028 | 0.644656 | 0.850277 | 0.453977 | 0.035026 | 0.074058 | 0.603102 | 0.552415 | 0.477383 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 2.122301 | 1.061151 |      2.32 |  0.0 |      0.8 |  0.25856 |  8.764354 |  0.0 |      2.32 |  1.094569 | 0.088981 | 0.619547 | 0.839814 |  1.094569 | 1.732394 |      0.0 |  0.0 |  0.0 |  177.38141 | 1.086399 |  0.008171 | 0.088981 | 0.619547 | 0.839814 |  0.47343 | 0.022985 | 0.074811 | 0.605842 | 0.555326 | 0.481221 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 2.150411 | 1.075205 |      0.04 |  0.0 |      0.8 | 0.272381 |  8.764354 |  0.0 |      0.04 |  0.018544 | 0.088691 | 0.612629 | 0.836907 |  0.018544 | 1.740398 |      0.0 |  0.0 |  0.0 | 175.592259 | 0.018544 |       0.0 | 0.088691 | 0.612629 | 0.836907 | 0.484534 | 0.015415 | 0.075495 | 0.606811 | 0.558143 | 0.483444 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 1.863566 | 0.931783 |       0.0 |  0.0 |     0.36 | 0.565298 |  8.815608 |  0.0 |       0.0 |       0.0 | 0.087796 | 0.591505 | 0.827961 |       0.0 | 1.651009 |      0.0 |  0.0 |  0.0 | 173.519699 |      0.0 |       0.0 | 0.087796 | 0.591505 | 0.827961 | 0.398328 |  0.00935 | 0.076116 | 0.606343 | 0.560872 | 0.458614 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 3.115838 | 1.557919 |       0.0 |  0.0 |     0.36 | 1.182759 |  8.866861 |  0.0 |       0.0 |       0.0 |  0.08676 | 0.567346 | 0.817598 |       0.0 | 1.575695 |      0.0 |  0.0 |  0.0 | 170.865235 |      0.0 |       0.0 |  0.08676 | 0.567346 | 0.817598 | 0.326123 | 0.005671 | 0.076661 | 0.603762 | 0.563478 | 0.437693 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 1.940627 | 0.970313 |       0.0 |  0.0 |      0.0 | 0.956307 |  9.840678 |  0.0 |       0.0 |       0.0 | 0.085433 | 0.536899 | 0.804326 |       0.0 | 1.512331 |      0.0 |  0.0 |  0.0 | 168.482271 |      0.0 |       0.0 | 0.085433 | 0.536899 | 0.804326 | 0.267007 |  0.00344 |  0.07712 | 0.598824 |  0.56594 | 0.420092 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 2.122768 | 1.061384 |       0.0 |  0.0 |      0.0 | 1.044259 |  9.789425 |  0.0 |       0.0 |       0.0 | 0.084241 | 0.510046 | 0.792411 |       0.0 | 1.458074 |      0.0 |  0.0 |  0.0 | 166.051312 |      0.0 |       0.0 | 0.084241 | 0.510046 | 0.792411 | 0.218607 | 0.002086 | 0.077497 | 0.591632 | 0.568253 | 0.405021 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 1.314414 | 0.657207 |       0.0 |  0.0 |      0.0 | 0.645396 |  9.686918 |  0.0 |       0.0 |       0.0 | 0.083026 | 0.483131 | 0.780257 |       0.0 |  1.41103 |      0.0 |  0.0 |  0.0 | 164.059503 |      0.0 |       0.0 | 0.083026 | 0.483131 | 0.780257 |  0.17898 | 0.001265 | 0.077796 | 0.582566 | 0.570423 | 0.391953 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.602486 | 0.301243 |       0.0 |  0.0 |      0.0 | 0.295351 |  8.969368 |  0.0 |       0.0 |       0.0 |  0.08203 | 0.461443 | 0.770298 |       0.0 | 1.369845 |      0.0 |  0.0 |  0.0 | 162.450382 |      0.0 |       0.0 |  0.08203 | 0.461443 | 0.770298 | 0.146537 | 0.000767 | 0.078026 | 0.572054 | 0.572461 | 0.380513 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.109905 | 0.054952 |       0.0 |  0.0 |      0.0 | 0.053804 |  8.200565 |  0.0 |       0.0 |       0.0 | 0.081225 | 0.444166 | 0.762252 |       0.0 | 1.333723 |      0.0 |  0.0 |  0.0 | 161.108936 |      0.0 |       0.0 | 0.081225 | 0.444166 | 0.762252 | 0.119974 | 0.000466 | 0.078202 | 0.560693 | 0.574389 | 0.370479 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.035026 | 0.017513 |       0.0 |  0.0 |      0.0 | 0.017127 |  7.278002 |  0.0 |       0.0 |       0.0 | 0.080554 | 0.429932 | 0.755545 |       0.0 | 1.301981 |      0.0 |  0.0 |  0.0 | 159.825778 |      0.0 |       0.0 | 0.080554 | 0.429932 | 0.755545 | 0.098226 | 0.000282 | 0.078333 | 0.548915 | 0.576225 | 0.361662 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.016756 |  6.765466 |  0.0 |       0.0 |       0.0 | 0.079913 | 0.416462 | 0.749129 |       0.0 | 1.273935 |      0.0 |  0.0 |  0.0 | 158.563518 |      0.0 |       0.0 | 0.079913 | 0.416462 | 0.749129 | 0.080421 | 0.000171 | 0.078425 | 0.536941 | 0.577977 | 0.353871 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.033727 | 0.016863 |       0.0 |  0.0 |      0.0 | 0.016453 |  6.355438 |  0.0 |       0.0 |       0.0 | 0.079282 | 0.403351 | 0.742818 |       0.0 |  1.24892 |      0.0 |  0.0 |  0.0 | 157.321615 |      0.0 |       0.0 | 0.079282 | 0.403351 | 0.742818 | 0.065843 | 0.000104 | 0.078482 | 0.524841 | 0.579649 | 0.346922 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.033286 | 0.016643 |       0.0 |  0.0 |      0.0 | 0.016218 |  6.047917 |  0.0 |       0.0 |       0.0 | 0.078661 | 0.390589 | 0.736608 |       0.0 | 1.226381 |      0.0 |  0.0 |  0.0 | 156.099539 |      0.0 |       0.0 | 0.078661 | 0.390589 | 0.736608 | 0.053908 | 0.000063 | 0.078506 | 0.512663 | 0.581242 | 0.340661 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.032916 | 0.016458 |       0.0 |  0.0 |      0.0 | 0.016018 |  5.791649 |  0.0 |       0.0 |       0.0 |  0.07805 | 0.378165 | 0.730498 |       0.0 | 1.205875 |      0.0 |  0.0 |  0.0 | 154.896809 |      0.0 |       0.0 |  0.07805 | 0.378165 | 0.730498 | 0.044136 | 0.000038 | 0.078498 | 0.500445 | 0.582757 | 0.334965 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.016428 |  6.406692 |  0.0 |       0.0 |       0.0 | 0.077448 | 0.366069 | 0.724484 |       0.0 | 1.187041 |      0.0 |  0.0 |  0.0 | 153.712379 |      0.0 |       0.0 | 0.077448 | 0.366069 | 0.724484 | 0.036135 | 0.000023 | 0.078462 | 0.488223 | 0.584197 | 0.329734 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.016478 |  6.509199 |  0.0 |       0.0 |       0.0 | 0.076856 | 0.354286 | 0.718562 |       0.0 | 1.169589 |      0.0 |  0.0 |  0.0 | 152.546197 |      0.0 |       0.0 | 0.076856 | 0.354286 | 0.718562 | 0.029585 | 0.000014 | 0.078398 | 0.476029 | 0.585563 | 0.324886 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.033434 | 0.016717 |      0.76 |  0.0 | 0.016717 |      0.0 |  6.150424 |  0.0 |      0.76 |  0.256904 | 0.076273 | 0.342811 | 0.712731 |  0.256904 | 1.177345 | 0.783283 |  0.0 |  0.0 | 151.917478 | 0.256904 |       0.0 | 0.076273 | 0.342811 | 0.712731 | 0.048282 | 0.000009 | 0.078308 | 0.463888 | 0.586858 |  0.32704 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 |  0.03336 |  0.01668 |       0.0 |  0.0 |  0.01668 |      0.0 |   6.09917 |  0.0 |       0.0 |       0.0 | 0.075959 | 0.336677 | 0.709587 |       0.0 |  1.18041 | 0.766603 |  0.0 |  0.0 | 150.795255 |      0.0 |       0.0 | 0.075959 | 0.336677 | 0.709587 | 0.062039 | 0.000005 | 0.078201 |  0.45207 | 0.588095 | 0.327892 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 | 0.016973 |      0.0 |  6.509199 |  0.0 |       0.0 |       0.0 | 0.075398 |  0.32582 | 0.703976 |       0.0 | 1.158713 |  0.74963 |  0.0 |  0.0 | 149.690062 |      0.0 |       0.0 | 0.075398 |  0.32582 | 0.703976 | 0.050793 | 0.000003 | 0.078078 | 0.440563 | 0.589275 | 0.321865 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.124092 | 0.062046 |       0.0 |  0.0 | 0.062046 |      0.0 |  6.662959 |  0.0 |       0.0 |       0.0 | 0.074845 | 0.315244 |  0.69845 |       0.0 | 1.139043 | 0.687585 |  0.0 |  0.0 | 148.601523 |      0.0 |       0.0 | 0.074845 | 0.315244 |  0.69845 | 0.041586 | 0.000002 | 0.077934 | 0.429132 | 0.590389 | 0.316401 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.727585 |  0.0 | 0.278392 |      0.0 |  6.457945 |  0.0 |  0.727585 |   0.23476 | 0.074301 | 0.304942 | 0.693008 |   0.23476 | 1.143038 | 0.521608 |  0.0 |  0.0 | 148.022097 |  0.23476 |       0.0 | 0.074301 | 0.304942 | 0.693008 | 0.056034 | 0.000001 |  0.07777 | 0.417796 | 0.591437 | 0.317511 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 |  1.27835 | 0.639175 |  0.201608 |  0.0 | 0.639175 |      0.0 |  6.252931 |  0.0 |  0.201608 |  0.064476 | 0.074011 | 0.299505 |  0.69011 |  0.064476 | 1.149305 | 0.160825 |  0.0 |  0.0 | 147.095603 | 0.064476 |       0.0 | 0.074011 | 0.299505 |  0.69011 | 0.072484 | 0.000001 | 0.077594 | 0.406794 | 0.592434 | 0.319251 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 |  2.07666 |  1.03833 |       0.0 |  0.0 | 0.280825 | 0.729729 |  6.355438 |  0.0 |       0.0 |       0.0 | 0.073548 | 0.290879 | 0.685478 |       0.0 |  1.13195 |      0.0 |  0.0 |  0.0 | 145.315969 |      0.0 |       0.0 | 0.073548 | 0.290879 | 0.685478 | 0.064994 |      0.0 | 0.077407 | 0.396166 | 0.593382 | 0.314431 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 | 2.862014 | 1.431007 |       0.0 |  0.0 |     0.48 | 0.914014 |  7.072988 |  0.0 |       0.0 |       0.0 | 0.072658 | 0.274549 |  0.67658 |       0.0 | 1.110021 |      0.0 |  0.0 |  0.0 | 143.378168 |      0.0 |       0.0 | 0.072658 | 0.274549 |  0.67658 | 0.053212 |      0.0 | 0.077197 | 0.385357 | 0.594254 | 0.308339 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 3.356573 | 1.678286 |       0.0 |  0.0 |      0.0 | 1.608745 |  9.174382 |  0.0 |       0.0 |       0.0 | 0.071689 | 0.257128 | 0.666891 |       0.0 | 1.089514 |      0.0 |  0.0 |  0.0 | 140.773716 |      0.0 |       0.0 | 0.071689 | 0.257128 | 0.666891 | 0.043567 |      0.0 | 0.076952 |  0.37397 | 0.595025 | 0.302643 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 3.356514 | 1.678257 |       0.0 |  0.0 |      0.0 | 1.602677 |  9.738171 |  0.0 |       0.0 |       0.0 | 0.070387 | 0.234322 | 0.653869 |       0.0 | 1.069756 |      0.0 |  0.0 |  0.0 | 138.212461 |      0.0 |       0.0 | 0.070387 | 0.234322 | 0.653869 | 0.035669 |      0.0 | 0.076663 | 0.361747 | 0.595675 | 0.297154 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 4.286095 | 2.143048 |       0.0 |  0.0 |      0.0 | 2.038476 |  11.89082 |  0.0 |       0.0 |       0.0 | 0.069106 | 0.212594 | 0.641062 |       0.0 |  1.05029 |      0.0 |  0.0 |  0.0 | 135.251223 |      0.0 |       0.0 | 0.069106 | 0.212594 | 0.641062 | 0.029204 |      0.0 | 0.076326 |  0.34857 | 0.596191 | 0.291747 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 3.753358 | 1.876679 |       0.0 |  0.0 |      0.0 | 1.776399 | 11.378284 |  0.0 |       0.0 |       0.0 | 0.067626 | 0.188367 | 0.626256 |       0.0 | 1.030869 |      0.0 |  0.0 |  0.0 | 132.592576 |      0.0 |       0.0 | 0.067626 | 0.188367 | 0.626256 |  0.02391 |      0.0 | 0.075937 | 0.334458 | 0.596563 | 0.286352 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 3.144766 | 1.572383 |       0.0 |  0.0 |      0.0 |  1.48137 | 11.583298 |  0.0 |       0.0 |       0.0 | 0.066296 | 0.167464 | 0.612963 |       0.0 | 1.011412 |      0.0 |  0.0 |  0.0 | 130.264484 |      0.0 |       0.0 | 0.066296 | 0.167464 | 0.612963 | 0.019576 |      0.0 | 0.075499 | 0.319545 | 0.596793 | 0.280948 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 2.519332 | 1.259666 |       0.0 |  0.0 |      0.0 | 1.181556 | 11.788313 |  0.0 |       0.0 |       0.0 | 0.065132 | 0.149845 | 0.601322 |       0.0 | 0.992164 |      0.0 |  0.0 |  0.0 | 128.266628 |      0.0 |       0.0 | 0.065132 | 0.149845 | 0.601322 | 0.016027 |      0.0 | 0.075022 |  0.30422 | 0.596895 | 0.275601 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.179366 | 0.589683 |       0.0 |  0.0 |      0.0 | 0.550923 | 10.711988 |  0.0 |       0.0 |       0.0 | 0.064133 | 0.135255 | 0.591333 |       0.0 |  0.97335 |      0.0 |  0.0 |  0.0 | 126.924984 |      0.0 |       0.0 | 0.064133 | 0.135255 | 0.591333 | 0.013122 |      0.0 | 0.074515 | 0.288823 |  0.59689 | 0.270375 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 0.523693 | 0.261846 |       0.0 |  0.0 |      0.0 | 0.243955 |  9.533157 |  0.0 |       0.0 |       0.0 | 0.063462 | 0.125741 | 0.584625 |       0.0 | 0.955286 |      0.0 |  0.0 |  0.0 | 125.907201 |      0.0 |       0.0 | 0.063462 | 0.125741 | 0.584625 | 0.010743 |      0.0 | 0.073992 | 0.273749 | 0.596801 | 0.265357 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 |  0.13182 |  0.06591 |       0.0 |  0.0 |      0.0 | 0.061273 |  8.200565 |  0.0 |       0.0 |       0.0 | 0.062954 | 0.118679 | 0.579536 |       0.0 | 0.938239 |      0.0 |  0.0 |  0.0 |  125.08476 |      0.0 |       0.0 | 0.062954 | 0.118679 | 0.579536 | 0.008796 |      0.0 | 0.073466 | 0.259323 | 0.596654 | 0.260622 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 0.035803 | 0.017902 |       0.0 |  0.0 |      0.0 | 0.016612 |  7.841791 |  0.0 |       0.0 |       0.0 | 0.062542 | 0.113073 | 0.575424 |       0.0 | 0.922276 |      0.0 |  0.0 |  0.0 | 124.317109 |      0.0 |       0.0 | 0.062542 | 0.113073 | 0.575424 | 0.007202 |      0.0 | 0.072943 | 0.245668 | 0.596464 | 0.256188 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.015891 |  6.765466 |  0.0 |       0.0 |       0.0 | 0.062159 | 0.107922 | 0.571586 |       0.0 | 0.907358 |      0.0 |  0.0 |  0.0 | 123.559551 |      0.0 |       0.0 | 0.062159 | 0.107922 | 0.571586 | 0.005896 |      0.0 | 0.072427 |   0.2328 | 0.596235 | 0.252044 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.015629 |  6.406692 |  0.0 |       0.0 |       0.0 |  0.06178 | 0.102918 | 0.567798 |       0.0 | 0.893389 |      0.0 |  0.0 |  0.0 | 122.811426 |      0.0 |       0.0 |  0.06178 | 0.102918 | 0.567798 | 0.004827 |      0.0 | 0.071916 | 0.220675 | 0.595971 | 0.248164 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.015669 |  6.509199 |  0.0 |       0.0 |       0.0 | 0.061406 | 0.098055 | 0.564057 |       0.0 |  0.88027 |      0.0 |  0.0 |  0.0 | 122.072239 |      0.0 |       0.0 | 0.061406 | 0.098055 | 0.564057 | 0.003952 |      0.0 | 0.071413 | 0.209233 | 0.595672 |  0.24452 |

    .. raw:: html

        <iframe
            src="lland_v2_ex1.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 2.1 <lland_v1_ex2_1>`

    The following calculation shows, that the outflow values of the
    integration test for water areas of type |WASSER| are reproduced
    exactly (when parameter |NegQ| is set to `False`):

    >>> lnk(WASSER)
    >>> test('lland_v2_ex2_1')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |         q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 | qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |    outlet |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 | 0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.477367 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497508 |  0.132602 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.03912 |  0.01956 |  0.0 |  0.0 |  0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.472998 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492558 |  0.131388 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.468261 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487657 |  0.130072 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.463607 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.482805 |   0.12878 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.458605 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.478001 |   0.12739 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.041104 | 0.020552 |  0.0 |  0.0 | 0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.452692 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.473245 |  0.125748 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 | 0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.410154 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.468536 |  0.113932 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 | 0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.077299 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.463874 |  0.021472 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 | 0.459258 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.459258 |       0.0 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 | 0.454688 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.454688 |       0.0 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 | 0.450164 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.450164 |       0.0 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 | 0.445685 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445685 |       0.0 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 |  0.44125 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.44125 |       0.0 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 |  0.43686 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.43686 |       0.0 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 | 0.432513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.432513 |       0.0 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | 0.478302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.189907 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.428209 |  0.052752 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 0.731934 | 0.365967 |  0.0 |  0.0 | 0.365967 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.057982 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.423949 |  0.016106 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | 0.227314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.192416 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.41973 |  0.053449 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 | 0.150197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.825357 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.415554 |  0.507044 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 | 0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   7.08664 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.411419 |  1.968511 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 | 0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.86744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.407325 |  1.074289 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 | 0.039382 | 0.019691 |  0.0 |  0.0 | 0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.263582 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.403272 |  1.739884 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 | 0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 13.099634 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.39926 |  3.638787 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.495792 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.395287 |   0.13772 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.211859 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.391354 |  0.336628 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.967965 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.38746 |  1.102213 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.884208 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.383605 |  0.801169 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |  0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 12.840457 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.379788 |  3.566794 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 | 0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.556744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.376009 |  1.265762 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.433069 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.372267 |  1.231408 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |  0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.771104 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.368563 |  0.491973 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 | 0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.231974 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.364896 |  0.064437 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 | 0.361265 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.361265 |       0.0 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 | 0.357671 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.357671 |       0.0 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 |   0.9844 |   0.4922 |  0.0 |  0.0 |   0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.341911 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.354112 |  0.094975 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 | 0.470588 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.350588 |       0.0 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 | 0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.992143 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3471 |  1.108929 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 | 1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  5.659335 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.343646 |  1.572038 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 | 0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.851022 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340227 |  0.236395 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 | 0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  24.75469 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.336841 |  6.876303 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 | 0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 45.365638 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.33349 | 12.601566 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |  0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.594602 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.330172 |  2.665167 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |  0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.328596 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.326886 |  1.202388 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 | 0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.265313 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.323634 |  2.573698 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 | 0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 22.501889 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.320413 |  6.250525 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |  0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 18.778735 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.317225 |  5.216315 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |  0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  7.855819 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.314069 |  2.182172 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.573007 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.310944 |  0.714724 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 | 0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.169878 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.30785 |  1.713855 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.52685 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.304787 |  0.979681 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 | 0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.883993 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.301754 |  0.245554 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 | 0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.52092 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.298752 |    0.1447 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 | 0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.877738 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.295779 |  0.243816 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 | 0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.154517 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.292836 |  0.876255 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.061944 | 0.030972 |  0.0 |  0.0 | 0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.73895 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.289922 |  0.205264 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 | 0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.432964 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.287037 |  0.120268 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 | 0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.049436 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.284181 |  0.013732 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 | 0.281354 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.281354 |       0.0 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 | 0.638554 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.278554 |       0.0 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 | 1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.334632 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.275782 |  0.648509 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 | 1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.037833 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.273038 |  0.010509 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 | 0.630322 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.270322 |       0.0 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 | 0.627632 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.267632 |       0.0 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 | 0.264969 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.264969 |       0.0 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 | 0.262332 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.262332 |       0.0 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 | 0.259722 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.259722 |       0.0 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 | 0.257138 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.257138 |       0.0 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | 0.054952 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.199627 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.254579 |  0.055452 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | 0.017513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.234533 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.252046 |  0.065148 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.232384 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.249538 |  0.064551 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 | 0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.230192 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.247055 |  0.063942 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 | 0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.227954 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.244597 |  0.063321 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 | 0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.225705 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.242163 |  0.062696 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.222854 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.239754 |  0.061904 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.220395 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.237368 |  0.061221 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.033434 | 0.016717 |  0.0 |  0.0 | 0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.778289 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.235006 |  0.493969 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |  0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.215988 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.232668 |  0.059997 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.21338 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.230353 |  0.059272 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.124092 | 0.062046 |  0.0 |  0.0 | 0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.166015 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.228061 |  0.046115 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 | 0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |    0.7874 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.225792 |  0.218722 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 |  1.27835 | 0.639175 |  0.0 |  0.0 | 0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.06437 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.223545 |   0.01788 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 | 0.341321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.221321 |       0.0 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 | 0.699118 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.219118 |       0.0 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 | 0.216938 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.216938 |       0.0 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 |  0.21478 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.21478 |       0.0 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 4.286095 | 2.143048 |  0.0 |  0.0 | 0.212642 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.212642 |       0.0 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 | 0.210527 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.210527 |       0.0 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 | 0.208432 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.208432 |       0.0 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 | 0.206358 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.206358 |       0.0 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.179366 | 0.589683 |  0.0 |  0.0 | 0.204305 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.204305 |       0.0 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 | 0.202272 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.202272 |       0.0 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 |  0.06591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.134349 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.200259 |  0.037319 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | 0.017902 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.180365 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.198267 |  0.050101 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.17914 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.196294 |  0.049761 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.177441 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.194341 |  0.049289 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.175434 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.192407 |  0.048732 |

    .. raw:: html

        <iframe
            src="lland_v2_ex2_1.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    :ref:`Modification of example 2.1 <lland_v1_ex2_1>`

    As discussed in the documentation of |lland_v1|, the handling of
    evaporation from water surfaces might be problematic.  |lland_v1|
    offers a smoothung option for the calculation of |ET0| (see method
    |calc_et0_wet0_v1|. In principle, the "delay weighing factor" |WfET0|
    can be applied on all land use classes.  However, its original
    intention is to allow for reflecting the temporal persistence of
    (large) water bodies.  This is demonstrated by setting the weighting
    parameter |WfET0| to a value smaller than one and defining a suitable
    "old" evaporation value (|WET0|):

    >>> wfet0(0.01)
    >>> test.inits.wet0 = 1.0

    Now |ET0| and (at least in low flow situations) consequently
    |lland_fluxes.Q| are strongly dampened:

    >>> test('lland_v2_ex2_1a')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |         q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 | qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |    outlet |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.990403 | 0.495201 |  0.0 |  0.0 | 0.495201 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.002307 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497508 |  0.000641 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.98089 | 0.490445 |  0.0 |  0.0 | 0.490445 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.002113 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492558 |  0.000587 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.971469 | 0.485735 |  0.0 |  0.0 | 0.485735 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.001922 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487657 |  0.000534 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.962138 | 0.481069 |  0.0 |  0.0 | 0.481069 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.001736 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.482805 |  0.000482 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.952905 | 0.476452 |  0.0 |  0.0 | 0.476452 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.001548 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.478001 |   0.00043 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.943787 | 0.471893 |  0.0 |  0.0 | 0.471893 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.001351 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.473245 |  0.000375 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.935517 | 0.467758 |  0.0 |  0.0 | 0.467758 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.000777 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.468536 |  0.000216 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 | 0.933893 | 0.466946 |  0.0 |  0.0 | 0.463874 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.463874 |       0.0 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 0.942032 | 0.471016 |  0.0 |  0.0 | 0.459258 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.459258 |       0.0 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 0.961882 | 0.480941 |  0.0 |  0.0 | 0.454688 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.454688 |       0.0 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 0.985321 |  0.49266 |  0.0 |  0.0 | 0.450164 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.450164 |       0.0 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 1.012947 | 0.506473 |  0.0 |  0.0 | 0.445685 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445685 |       0.0 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 1.023322 | 0.511661 |  0.0 |  0.0 |  0.44125 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.44125 |       0.0 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 1.039589 | 0.519795 |  0.0 |  0.0 |  0.43686 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.43686 |       0.0 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 1.058784 | 0.529392 |  0.0 |  0.0 | 0.432513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.432513 |       0.0 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 1.057762 | 0.528881 |  0.0 |  0.0 | 0.528881 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.139328 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.428209 |  0.038702 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 1.054504 | 0.527252 |  0.0 |  0.0 | 0.423949 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.423949 |       0.0 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 1.048505 | 0.524252 |  0.0 |  0.0 |  0.41973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.41973 |       0.0 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 1.041024 | 0.520512 |  0.0 |  0.0 | 0.520512 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.455042 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.415554 |  0.404178 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 1.031509 | 0.515755 |  0.0 |  0.0 | 0.515755 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.615665 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.411419 |  1.837685 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 | 1.021592 | 0.510796 |  0.0 |  0.0 | 0.510796 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.37653 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.407325 |  0.937925 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 |  1.01177 | 0.505885 |  0.0 |  0.0 | 0.505885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  5.777388 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.403272 |   1.60483 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 1.002044 | 0.501022 |  0.0 |  0.0 | 0.501022 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 12.618238 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.39926 |  3.505066 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 | 0.992414 | 0.496207 |  0.0 |  0.0 | 0.496207 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.01908 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.395287 |    0.0053 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.98288 |  0.49144 |  0.0 |  0.0 |  0.49144 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.739914 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.391354 |  0.205532 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 | 0.973441 |  0.48672 |  0.0 |  0.0 |  0.48672 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.50074 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.38746 |  0.972428 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.964094 | 0.482047 |  0.0 |  0.0 | 0.482047 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.421557 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.383605 |  0.672655 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 |  0.95484 |  0.47742 |  0.0 |  0.0 |  0.47742 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 12.382368 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.379788 |  3.439547 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.945677 | 0.472838 |  0.0 |  0.0 | 0.472838 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   4.10317 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.376009 |   1.13977 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.936604 | 0.468302 |  0.0 |  0.0 | 0.468302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.983965 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.372267 |  1.106657 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.927987 | 0.463994 |  0.0 |  0.0 | 0.463994 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   1.34457 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.368563 |  0.373492 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.923766 | 0.461883 |  0.0 |  0.0 | 0.461883 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.023013 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.364896 |  0.006393 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 |  0.92671 | 0.463355 |  0.0 |  0.0 | 0.361265 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.361265 |       0.0 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.925166 | 0.462583 |  0.0 |  0.0 | 0.357671 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.357671 |       0.0 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 | 0.925758 | 0.462879 |  0.0 |  0.0 | 0.462879 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.371232 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.354112 |   0.10312 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 0.941365 | 0.470682 |  0.0 |  0.0 | 0.470588 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.350588 |       0.0 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 |  0.94545 | 0.472725 |  0.0 |  0.0 | 0.472725 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.194375 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3471 |  1.165104 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 0.971282 | 0.485641 |  0.0 |  0.0 | 0.485641 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.938005 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.343646 |  1.927224 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 | 0.977753 | 0.488877 |  0.0 |  0.0 | 0.488877 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   1.17135 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340227 |  0.325375 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.976419 | 0.488209 |  0.0 |  0.0 | 0.488209 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 24.688632 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.336841 |  6.857953 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.975611 | 0.487806 |  0.0 |  0.0 | 0.487806 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 45.325684 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.33349 | 12.590468 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 0.977367 | 0.488683 |  0.0 |  0.0 | 0.488683 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.681488 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.330172 |  2.689302 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.973959 | 0.486979 |  0.0 |  0.0 | 0.486979 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.159907 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.326886 |   1.15553 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.965386 | 0.482693 |  0.0 |  0.0 | 0.482693 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  8.840941 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.323634 |  2.455817 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.956102 | 0.478051 |  0.0 |  0.0 | 0.478051 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 22.042362 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.320413 |  6.122878 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 | 0.946911 | 0.473456 |  0.0 |  0.0 | 0.473456 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  18.32377 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.317225 |  5.089936 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.937807 | 0.468904 |  0.0 |  0.0 | 0.468904 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  7.405165 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.314069 |   2.05699 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.928788 | 0.464394 |  0.0 |  0.0 | 0.464394 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   2.12655 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.310944 |  0.590708 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.919859 |  0.45993 |  0.0 |  0.0 |  0.45993 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   5.72792 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.30785 |  1.591089 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.911019 |  0.45551 |  0.0 |  0.0 |  0.45551 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.089277 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.304787 |  0.858133 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.902264 | 0.451132 |  0.0 |  0.0 | 0.451132 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.450622 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.301754 |  0.125173 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.893598 | 0.446799 |  0.0 |  0.0 | 0.446799 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.091952 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.298752 |  0.025542 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.885023 | 0.442512 |  0.0 |  0.0 | 0.442512 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.453267 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.295779 |  0.125908 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.876539 |  0.43827 |  0.0 |  0.0 |  0.43827 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.734566 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.292836 |  0.759602 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.868393 | 0.434197 |  0.0 |  0.0 | 0.434197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.335725 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.289922 |  0.093257 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.861591 | 0.430795 |  0.0 |  0.0 | 0.430795 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.096242 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.287037 |  0.026734 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.85767 | 0.428835 |  0.0 |  0.0 | 0.284181 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.284181 |       0.0 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 0.865902 | 0.432951 |  0.0 |  0.0 | 0.281354 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.281354 |       0.0 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 0.874682 | 0.437341 |  0.0 |  0.0 | 0.437341 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.201213 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.278554 |  0.055892 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 0.887158 | 0.443579 |  0.0 |  0.0 | 0.443579 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.952203 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.275782 |  0.820056 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 0.899791 | 0.449895 |  0.0 |  0.0 | 0.449895 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.663143 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.273038 |  0.184206 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 0.909429 | 0.454714 |  0.0 |  0.0 | 0.454714 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.175607 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.270322 |   0.04878 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 0.931493 | 0.465746 |  0.0 |  0.0 | 0.465746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.161885 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.267632 |  0.044968 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 0.941584 | 0.470792 |  0.0 |  0.0 | 0.264969 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.264969 |       0.0 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 0.953396 | 0.476698 |  0.0 |  0.0 | 0.262332 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.262332 |       0.0 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 0.957006 | 0.478503 |  0.0 |  0.0 | 0.259722 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.259722 |       0.0 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.953461 |  0.47673 |  0.0 |  0.0 | 0.257138 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.257138 |       0.0 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.945025 | 0.472513 |  0.0 |  0.0 | 0.254579 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.254579 |       0.0 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.935925 | 0.467963 |  0.0 |  0.0 | 0.252046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.252046 |       0.0 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.926909 | 0.463455 |  0.0 |  0.0 | 0.249538 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.249538 |       0.0 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.917977 | 0.458989 |  0.0 |  0.0 | 0.247055 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.247055 |       0.0 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.909131 | 0.454565 |  0.0 |  0.0 | 0.244597 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.244597 |       0.0 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.900368 | 0.450184 |  0.0 |  0.0 | 0.242163 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.242163 |       0.0 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 | 0.891703 | 0.445851 |  0.0 |  0.0 | 0.239754 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.239754 |       0.0 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.883125 | 0.441563 |  0.0 |  0.0 | 0.237368 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.237368 |       0.0 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.874628 | 0.437314 |  0.0 |  0.0 | 0.437314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.357692 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.235006 |  0.377137 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 | 0.866216 | 0.433108 |  0.0 |  0.0 | 0.232668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.232668 |       0.0 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.857893 | 0.428946 |  0.0 |  0.0 | 0.230353 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.230353 |       0.0 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.850555 | 0.425277 |  0.0 |  0.0 | 0.228061 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.228061 |       0.0 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.847617 | 0.423809 |  0.0 |  0.0 | 0.423809 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.641983 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.225792 |  0.178329 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 | 0.851924 | 0.425962 |  0.0 |  0.0 | 0.425962 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.277583 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.223545 |  0.077106 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 | 0.864172 | 0.432086 |  0.0 |  0.0 | 0.341321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.221321 |       0.0 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 |  0.88415 | 0.442075 |  0.0 |  0.0 | 0.442075 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.257043 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.219118 |  0.071401 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 0.908874 | 0.454437 |  0.0 |  0.0 | 0.216938 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.216938 |       0.0 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 0.933351 | 0.466675 |  0.0 |  0.0 |  0.21478 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.21478 |       0.0 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 0.966878 | 0.483439 |  0.0 |  0.0 | 0.212642 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.212642 |       0.0 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 0.994743 | 0.497372 |  0.0 |  0.0 | 0.210527 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.210527 |       0.0 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 1.016243 | 0.508122 |  0.0 |  0.0 | 0.208432 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.208432 |       0.0 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 1.031274 | 0.515637 |  0.0 |  0.0 | 0.206358 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.206358 |       0.0 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.032755 | 0.516378 |  0.0 |  0.0 | 0.204305 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.204305 |       0.0 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 1.027664 | 0.513832 |  0.0 |  0.0 | 0.202272 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.202272 |       0.0 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 | 1.018706 | 0.509353 |  0.0 |  0.0 | 0.200259 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.200259 |       0.0 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 1.008877 | 0.504439 |  0.0 |  0.0 | 0.198267 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.198267 |       0.0 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.999131 | 0.499566 |  0.0 |  0.0 | 0.196294 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.196294 |       0.0 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 | 0.989478 | 0.494739 |  0.0 |  0.0 | 0.194341 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.194341 |       0.0 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.979923 | 0.489961 |  0.0 |  0.0 | 0.192407 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.192407 |       0.0 |

    .. raw:: html

        <iframe
            src="lland_v2_ex2_1a.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    >>> wfet0(1.0)
    >>> test.inits.wet0 = 0.0

    :ref:`Recalculation of example 2.2 <lland_v1_ex2_2>`

    The following calculation shows, that the outflow values of the
    integration test for water areas of type |WASSER| are reproduced
    exactly (when parameter |NegQ| is set to `True`):

    >>> negq(True)
    >>> test('lland_v2_ex2_2')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |         q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 | qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |    outlet |
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 | 0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.477367 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497508 |  0.132602 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.03912 |  0.01956 |  0.0 |  0.0 |  0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.472998 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492558 |  0.131388 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.468261 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487657 |  0.130072 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.463607 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.482805 |   0.12878 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.458605 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.478001 |   0.12739 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.041104 | 0.020552 |  0.0 |  0.0 | 0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.452692 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.473245 |  0.125748 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 | 0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.410154 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.468536 |  0.113932 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 | 0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.077299 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.463874 |  0.021472 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 | 0.873907 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.414649 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.459258 |  -0.11518 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 | 1.463511 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.008823 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.454688 | -0.280229 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 | 1.652872 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.202708 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.450164 | -0.334086 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 | 1.873973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.428288 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445685 | -0.396747 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 | 1.025236 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.583985 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.44125 | -0.162218 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 | 1.325006 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.888146 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.43686 | -0.246707 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 | 1.479524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.047011 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.432513 | -0.290836 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | 0.478302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.189907 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.428209 |  0.052752 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 0.731934 | 0.365967 |  0.0 |  0.0 | 0.365967 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.057982 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.423949 |  0.016106 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | 0.227314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.192416 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.41973 |  0.053449 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 | 0.150197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.825357 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.415554 |  0.507044 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 | 0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   7.08664 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.411419 |  1.968511 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 | 0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.86744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.407325 |  1.074289 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 | 0.039382 | 0.019691 |  0.0 |  0.0 | 0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.263582 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.403272 |  1.739884 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 | 0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 13.099634 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.39926 |  3.638787 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.495792 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.395287 |   0.13772 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.211859 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.391354 |  0.336628 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.967965 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.38746 |  1.102213 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.884208 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.383605 |  0.801169 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |  0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 12.840457 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.379788 |  3.566794 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 | 0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.556744 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.376009 |  1.265762 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.433069 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.372267 |  1.231408 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |  0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.771104 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.368563 |  0.491973 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 | 0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.231974 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.364896 |  0.064437 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 | 0.609108 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.247842 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.361265 | -0.068845 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 | 0.386152 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.028481 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.357671 | -0.007911 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 |   0.9844 |   0.4922 |  0.0 |  0.0 |   0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.341911 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.354112 |  0.094975 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 | 1.243189 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.772601 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.350588 | -0.214611 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 | 0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.992143 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3471 |  1.108929 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 | 1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  5.659335 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.343646 |  1.572038 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 | 0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.851022 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340227 |  0.236395 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 | 0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  24.75469 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.336841 |  6.876303 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 | 0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 45.365638 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.33349 | 12.601566 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |  0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.594602 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.330172 |  2.665167 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |  0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  4.328596 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.326886 |  1.202388 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 | 0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  9.265313 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.323634 |  2.573698 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 | 0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 22.501889 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.320413 |  6.250525 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |  0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 18.778735 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.317225 |  5.216315 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |  0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  7.855819 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.314069 |  2.182172 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.573007 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.310944 |  0.714724 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 | 0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  6.169878 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.30785 |  1.713855 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   3.52685 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.304787 |  0.979681 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 | 0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.883993 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.301754 |  0.245554 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 | 0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.52092 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.298752 |    0.1447 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 | 0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.877738 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.295779 |  0.243816 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 | 0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  3.154517 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.292836 |  0.876255 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.061944 | 0.030972 |  0.0 |  0.0 | 0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.73895 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.289922 |  0.205264 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 | 0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.432964 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.287037 |  0.120268 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 | 0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.049436 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.284181 |  0.013732 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 | 0.840459 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.559106 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.281354 | -0.155307 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 | 0.871943 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.233389 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.278554 |  -0.06483 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 | 1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.334632 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.275782 |  0.648509 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 | 1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.037833 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.273038 |  0.010509 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 | 0.931783 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.301461 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.270322 | -0.083739 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 | 1.557919 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.930287 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.267632 | -0.258413 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 | 0.970313 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.705345 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.264969 | -0.195929 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 | 1.061384 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.799052 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.262332 | -0.221959 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 | 0.657207 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.397485 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.259722 | -0.110413 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 | 0.301243 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.044105 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.257138 | -0.012251 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | 0.054952 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.199627 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.254579 |  0.055452 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | 0.017513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.234533 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.252046 |  0.065148 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.232384 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.249538 |  0.064551 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 | 0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.230192 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.247055 |  0.063942 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 | 0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.227954 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.244597 |  0.063321 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 | 0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.225705 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.242163 |  0.062696 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.222854 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.239754 |  0.061904 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.220395 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.237368 |  0.061221 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.033434 | 0.016717 |  0.0 |  0.0 | 0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.778289 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.235006 |  0.493969 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |  0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.215988 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.232668 |  0.059997 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.21338 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.230353 |  0.059272 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.124092 | 0.062046 |  0.0 |  0.0 | 0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.166015 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.228061 |  0.046115 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 | 0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |    0.7874 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.225792 |  0.218722 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 |  1.27835 | 0.639175 |  0.0 |  0.0 | 0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.06437 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.223545 |   0.01788 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 |  1.03833 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  -0.69701 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.221321 | -0.193614 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 | 1.431007 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.731889 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.219118 | -0.203302 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 | 1.678286 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.461348 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.216938 |  -0.40593 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 | 1.678257 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.463478 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.21478 | -0.406522 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 4.286095 | 2.143048 |  0.0 |  0.0 | 2.143048 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.930405 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.212642 | -0.536224 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 | 1.876679 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.666152 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.210527 |  -0.46282 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 | 1.572383 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.363951 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.208432 | -0.378875 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 | 1.259666 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -1.053308 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.206358 | -0.292586 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.179366 | 0.589683 |  0.0 |  0.0 | 0.589683 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.385379 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.204305 |  -0.10705 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 | 0.261846 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | -0.059575 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.202272 | -0.016549 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 |  0.06591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.134349 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.200259 |  0.037319 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | 0.017902 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.180365 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.198267 |  0.050101 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.17914 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.196294 |  0.049761 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.177441 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.194341 |  0.049289 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.175434 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 0.192407 |  0.048732 |

    .. raw:: html

        <iframe
            src="lland_v2_ex2_2.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    >>> negq(False)

    :ref:`Recalculation of example 3 <lland_v1_ex3>`

    The following calculation shows, that the outflow values of the
    integration test for water areas of type |SEE| are reproduced
    exactly:

    >>> lnk(SEE)
    >>> test('lland_v2_ex3')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo | nbes | sbes |      evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb | qdgz |        q | inzp | wats | waes | bowa | qdgz1 | qdgz2 | qigz1 | qigz2 |      qbgz | qdga1 | qdga2 | qiga1 | qiga2 |     qbga |   outlet |
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 | 0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.497408 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.020141 |   0.0 |   0.0 |   0.0 |   0.0 | 0.497408 | 0.138169 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.03912 |  0.01956 |  0.0 |  0.0 |  0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.492261 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.01956 |   0.0 |   0.0 |   0.0 |   0.0 | 0.492261 | 0.136739 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.487169 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.019396 |   0.0 |   0.0 |   0.0 |   0.0 | 0.487169 | 0.135325 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.48213 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.019198 |   0.0 |   0.0 |   0.0 |   0.0 |  0.48213 | 0.133925 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.477141 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.019396 |   0.0 |   0.0 |   0.0 |   0.0 | 0.477141 | 0.132539 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.041104 | 0.020552 |  0.0 |  0.0 | 0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.472194 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.020552 |   0.0 |   0.0 |   0.0 |   0.0 | 0.472194 | 0.131165 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 | 0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.467103 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.058382 |   0.0 |   0.0 |   0.0 |   0.0 | 0.467103 | 0.129751 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 | 0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.460239 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.386575 |   0.0 |   0.0 |   0.0 |   0.0 | 0.460239 | 0.127844 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 | 0.873907 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.449384 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.873907 |   0.0 |   0.0 |   0.0 |   0.0 | 0.449384 | 0.124829 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 | 1.463511 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.433279 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.463511 |   0.0 |   0.0 |   0.0 |   0.0 | 0.433279 | 0.120355 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 | 1.652872 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.413462 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.652872 |   0.0 |   0.0 |   0.0 |   0.0 | 0.413462 | 0.114851 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 | 1.873973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |   0.3918 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.873973 |   0.0 |   0.0 |   0.0 |   0.0 |   0.3918 | 0.108833 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 | 1.025236 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.373484 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.025236 |   0.0 |   0.0 |   0.0 |   0.0 | 0.373484 | 0.103746 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 | 1.325006 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.358073 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.325006 |   0.0 |   0.0 |   0.0 |   0.0 | 0.358073 | 0.099465 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 | 1.479524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.340556 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.479524 |   0.0 |   0.0 |   0.0 |   0.0 | 0.340556 | 0.094599 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | 0.478302 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.328631 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.238302 |   0.0 |   0.0 |   0.0 |   0.0 | 0.328631 | 0.091287 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 0.731934 | 0.365967 |  0.0 |  0.0 | 0.365967 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.322354 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.365967 |   0.0 |   0.0 |   0.0 |   0.0 | 0.322354 | 0.089543 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | 0.227314 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.316196 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.227314 |   0.0 |   0.0 |   0.0 |   0.0 | 0.316196 | 0.087832 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 | 0.150197 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.318947 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  1.409803 |   0.0 |   0.0 |   0.0 |   0.0 | 0.318947 | 0.088596 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 | 0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.35604 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  6.675221 |   0.0 |   0.0 |   0.0 |   0.0 |  0.35604 |   0.0989 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 | 0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.402895 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.460115 |   0.0 |   0.0 |   0.0 |   0.0 | 0.402895 | 0.111915 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 | 0.039382 | 0.019691 |  0.0 |  0.0 | 0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.445276 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  5.860309 |   0.0 |   0.0 |   0.0 |   0.0 | 0.445276 | 0.123688 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 | 0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.533243 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 12.700374 |   0.0 |   0.0 |   0.0 |   0.0 | 0.533243 | 0.148123 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.591518 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.100505 |   0.0 |   0.0 |   0.0 |   0.0 | 0.591518 | 0.164311 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.590221 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.820505 |   0.0 |   0.0 |   0.0 |   0.0 | 0.590221 |  0.16395 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 | 0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.606266 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.580505 |   0.0 |   0.0 |   0.0 |   0.0 | 0.606266 | 0.168407 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 | 0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.630479 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.500604 |   0.0 |   0.0 |   0.0 |   0.0 | 0.630479 | 0.175133 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |  0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.698722 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  12.46067 |   0.0 |   0.0 |   0.0 |   0.0 | 0.698722 | 0.194089 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 | 0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.774493 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  4.180736 |   0.0 |   0.0 |   0.0 |   0.0 | 0.774493 | 0.215137 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 | 0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.807788 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  4.060802 |   0.0 |   0.0 |   0.0 |   0.0 | 0.807788 | 0.224386 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |  0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.826909 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   1.40254 |   0.0 |   0.0 |   0.0 |   0.0 | 0.826909 | 0.229697 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 | 0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.824985 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.132922 |   0.0 |   0.0 |   0.0 |   0.0 | 0.824985 | 0.229162 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 | 0.609108 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.81308 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.609108 |   0.0 |   0.0 |   0.0 |   0.0 |  0.81308 | 0.225856 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 | 0.386152 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.80004 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.386152 |   0.0 |   0.0 |   0.0 |   0.0 |  0.80004 | 0.222233 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 |   0.9844 |   0.4922 |  0.0 |  0.0 |   0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.790101 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   -0.0122 |   0.0 |   0.0 |   0.0 |   0.0 | 0.790101 | 0.219473 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 | 1.243189 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.776582 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.123189 |   0.0 |   0.0 |   0.0 |   0.0 | 0.776582 | 0.215717 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 | 0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.78144 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.645043 |   0.0 |   0.0 |   0.0 |   0.0 |  0.78144 | 0.217067 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 | 1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.818259 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  5.315689 |   0.0 |   0.0 |   0.0 |   0.0 | 0.818259 | 0.227294 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 | 0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.839065 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.510795 |   0.0 |   0.0 |   0.0 |   0.0 | 0.839065 | 0.233074 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 | 0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 0.954936 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 24.417849 |   0.0 |   0.0 |   0.0 |   0.0 | 0.954936 |  0.26526 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 | 0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.291125 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 45.032149 |   0.0 |   0.0 |   0.0 |   0.0 | 1.291125 | 0.358646 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |  0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.548111 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   9.26443 |   0.0 |   0.0 |   0.0 |   0.0 | 1.548111 | 0.430031 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |  0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.598664 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   4.00171 |   0.0 |   0.0 |   0.0 |   0.0 | 1.598664 | 0.444073 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 | 0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.647192 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  8.941679 |   0.0 |   0.0 |   0.0 |   0.0 | 1.647192 | 0.457553 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 | 0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.785753 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | 22.181476 |   0.0 |   0.0 |   0.0 |   0.0 | 1.785753 | 0.496042 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |  0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.970156 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  18.46151 |   0.0 |   0.0 |   0.0 |   0.0 | 1.970156 | 0.547265 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |  0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.07983 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   7.54175 |   0.0 |   0.0 |   0.0 |   0.0 |  2.07983 | 0.577731 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.107866 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.262063 |   0.0 |   0.0 |   0.0 |   0.0 | 2.107866 | 0.585518 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 | 0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.127341 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  5.862028 |   0.0 |   0.0 |   0.0 |   0.0 | 2.127341 | 0.590928 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 | 0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.151345 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  3.222063 |   0.0 |   0.0 |   0.0 |   0.0 | 2.151345 | 0.597596 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 | 0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.148844 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.582239 |   0.0 |   0.0 |   0.0 |   0.0 | 2.148844 | 0.596901 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 | 0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.131462 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.222169 |   0.0 |   0.0 |   0.0 |   0.0 | 2.131462 | 0.592073 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 | 0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.114257 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.581959 |   0.0 |   0.0 |   0.0 |   0.0 | 2.114257 | 0.587294 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 | 0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.110371 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.861681 |   0.0 |   0.0 |   0.0 |   0.0 | 2.110371 | 0.586214 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.061944 | 0.030972 |  0.0 |  0.0 | 0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.105823 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.449028 |   0.0 |   0.0 |   0.0 |   0.0 | 2.105823 | 0.584951 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 | 0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.087828 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.145926 |   0.0 |   0.0 |   0.0 |   0.0 | 2.087828 | 0.579952 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 | 0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.066608 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.234745 |   0.0 |   0.0 |   0.0 |   0.0 | 2.066608 | 0.574058 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 | 0.840459 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.040691 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.840459 |   0.0 |   0.0 |   0.0 |   0.0 | 2.040691 | 0.566859 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 | 0.871943 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  2.01366 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.511943 |   0.0 |   0.0 |   0.0 |   0.0 |  2.01366 |  0.55935 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 | 1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 2.001341 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  2.058849 |   0.0 |   0.0 |   0.0 |   0.0 | 2.001341 | 0.555928 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 | 1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.990481 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.235205 |   0.0 |   0.0 |   0.0 |   0.0 | 1.990481 | 0.552911 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 | 0.931783 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.966658 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.571783 |   0.0 |   0.0 |   0.0 |   0.0 | 1.966658 | 0.546294 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 | 1.557919 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.93828 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.197919 |   0.0 |   0.0 |   0.0 |   0.0 |  1.93828 | 0.538411 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 | 0.970313 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.908208 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.970313 |   0.0 |   0.0 |   0.0 |   0.0 | 1.908208 | 0.530058 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 | 1.061384 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.879113 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.061384 |   0.0 |   0.0 |   0.0 |   0.0 | 1.879113 | 0.521976 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 | 0.657207 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.851869 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.657207 |   0.0 |   0.0 |   0.0 |   0.0 | 1.851869 | 0.514408 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 | 0.301243 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.828677 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.301243 |   0.0 |   0.0 |   0.0 |   0.0 | 1.828677 | 0.507966 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | 0.054952 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.808711 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.054952 |   0.0 |   0.0 |   0.0 |   0.0 | 1.808711 |  0.50242 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | 0.017513 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.790354 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017513 |   0.0 |   0.0 |   0.0 |   0.0 | 1.790354 | 0.497321 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.772367 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017154 |   0.0 |   0.0 |   0.0 |   0.0 | 1.772367 | 0.492324 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 | 0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.754562 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016863 |   0.0 |   0.0 |   0.0 |   0.0 | 1.754562 | 0.487378 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 | 0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.736938 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016643 |   0.0 |   0.0 |   0.0 |   0.0 | 1.736938 | 0.482483 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 | 0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.71949 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016458 |   0.0 |   0.0 |   0.0 |   0.0 |  1.71949 | 0.477636 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.702215 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   -0.0169 |   0.0 |   0.0 |   0.0 |   0.0 | 1.702215 | 0.472837 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.685109 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016973 |   0.0 |   0.0 |   0.0 |   0.0 | 1.685109 | 0.468086 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.033434 | 0.016717 |  0.0 |  0.0 | 0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.675948 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  1.543283 |   0.0 |   0.0 |   0.0 |   0.0 | 1.675948 | 0.465541 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |  0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.666854 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.01668 |   0.0 |   0.0 |   0.0 |   0.0 | 1.666854 | 0.463015 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.650102 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016973 |   0.0 |   0.0 |   0.0 |   0.0 | 1.650102 | 0.458362 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.124092 | 0.062046 |  0.0 |  0.0 | 0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.633289 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.062046 |   0.0 |   0.0 |   0.0 |   0.0 | 1.633289 | 0.453691 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 | 0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.619528 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  0.561608 |   0.0 |   0.0 |   0.0 |   0.0 | 1.619528 | 0.449869 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 |  1.27835 | 0.639175 |  0.0 |  0.0 | 0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.60541 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.159175 |   0.0 |   0.0 |   0.0 |   0.0 |  1.60541 | 0.445947 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 |  1.03833 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.584069 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.91833 |   0.0 |   0.0 |   0.0 |   0.0 | 1.584069 | 0.440019 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 | 1.431007 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.559007 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.951007 |   0.0 |   0.0 |   0.0 |   0.0 | 1.559007 | 0.433057 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 | 1.678286 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.530407 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.678286 |   0.0 |   0.0 |   0.0 |   0.0 | 1.530407 | 0.425113 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 | 1.678257 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  1.49848 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.678257 |   0.0 |   0.0 |   0.0 |   0.0 |  1.49848 | 0.416245 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 4.286095 | 2.143048 |  0.0 |  0.0 | 2.143048 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.464555 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -2.143048 |   0.0 |   0.0 |   0.0 |   0.0 | 1.464555 | 0.406821 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 | 1.876679 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.429986 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.876679 |   0.0 |   0.0 |   0.0 |   0.0 | 1.429986 | 0.397218 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 | 1.572383 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.398601 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.572383 |   0.0 |   0.0 |   0.0 |   0.0 | 1.398601 |   0.3885 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 | 1.259666 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.370597 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -1.259666 |   0.0 |   0.0 |   0.0 |   0.0 | 1.370597 | 0.380722 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.179366 | 0.589683 |  0.0 |  0.0 | 0.589683 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.347765 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.589683 |   0.0 |   0.0 |   0.0 |   0.0 | 1.347765 | 0.374379 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 | 0.261846 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.330121 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.261846 |   0.0 |   0.0 |   0.0 |   0.0 | 1.330121 | 0.369478 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 |  0.06591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.315257 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |  -0.06591 |   0.0 |   0.0 |   0.0 |   0.0 | 1.315257 | 0.365349 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | 0.017902 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.301753 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017902 |   0.0 |   0.0 |   0.0 |   0.0 | 1.301753 | 0.361598 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 | 0.017154 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.288626 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.017154 |   0.0 |   0.0 |   0.0 |   0.0 | 1.288626 | 0.357952 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |   0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.275634 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 |   -0.0169 |   0.0 |   0.0 |   0.0 |   0.0 | 1.275634 | 0.354343 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | 0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.0 | 1.262773 |  0.0 |  0.0 |  0.0 |  0.0 |   0.0 |   0.0 |   0.0 |   0.0 | -0.016973 |   0.0 |   0.0 |   0.0 |   0.0 | 1.262773 |  0.35077 |

    .. raw:: html

        <iframe
            src="lland_v2_ex3.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 4 <lland_v1_ex4>`

    The following calculation shows, that the outflow values of the
    integration test for water areas of type |FLUSS| are reproduced
    exactly:

    >>> lnk(FLUSS)
    >>> test('lland_v2_ex4')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo | nbes | sbes |       evi | evb | wgtf | schm | wada | qdb | qib1 | qib2 | qbb |      qdgz |         q | inzp | wats | waes | bowa |     qdgz1 |     qdgz2 | qigz1 | qigz2 | qbgz |     qdga1 |     qdga2 | qiga1 | qiga2 |     qbga |   outlet |
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.040283 | 0.020141 |  0.0 |  0.0 |  0.020141 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.020141 |  0.495622 |  0.0 |  0.0 |  0.0 |  0.0 | -0.020141 |       0.0 |   0.0 |   0.0 |  0.0 | -0.001886 |       0.0 |   0.0 |   0.0 | 0.497508 | 0.137673 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.03912 |  0.01956 |  0.0 |  0.0 |   0.01956 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.01956 |  0.487417 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.01956 |       0.0 |   0.0 |   0.0 |  0.0 | -0.005141 |       0.0 |   0.0 |   0.0 | 0.492558 | 0.135394 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 |  0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.019396 |  0.479918 |  0.0 |  0.0 |  0.0 |  0.0 | -0.019396 |       0.0 |   0.0 |   0.0 |  0.0 | -0.007739 |       0.0 |   0.0 |   0.0 | 0.487657 |  0.13331 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 |  0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.019198 |  0.472971 |  0.0 |  0.0 |  0.0 |  0.0 | -0.019198 |       0.0 |   0.0 |   0.0 |  0.0 | -0.009834 |       0.0 |   0.0 |   0.0 | 0.482805 | 0.131381 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 |  0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.019396 |  0.466451 |  0.0 |  0.0 |  0.0 |  0.0 | -0.019396 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.01155 |       0.0 |   0.0 |   0.0 | 0.478001 |  0.12957 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.041104 | 0.020552 |  0.0 |  0.0 |  0.020552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.020552 |  0.460164 |  0.0 |  0.0 |  0.0 |  0.0 | -0.020552 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.01308 |       0.0 |   0.0 |   0.0 | 0.473245 | 0.127823 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.116763 | 0.058382 |  0.0 |  0.0 |  0.058382 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.058382 |  0.450558 |  0.0 |  0.0 |  0.0 |  0.0 | -0.058382 |       0.0 |   0.0 |   0.0 |  0.0 | -0.017978 |       0.0 |   0.0 |   0.0 | 0.468536 | 0.125155 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 |  0.77315 | 0.386575 |  0.0 |  0.0 |  0.386575 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.386575 |  0.407835 |  0.0 |  0.0 |  0.0 |  0.0 | -0.386575 |       0.0 |   0.0 |   0.0 |  0.0 | -0.056038 |       0.0 |   0.0 |   0.0 | 0.463874 | 0.113288 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 1.747814 | 0.873907 |  0.0 |  0.0 |  0.873907 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.873907 |  0.297663 |  0.0 |  0.0 |  0.0 |  0.0 | -0.873907 |       0.0 |   0.0 |   0.0 |  0.0 | -0.161595 |       0.0 |   0.0 |   0.0 | 0.459258 | 0.082684 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 2.927022 | 1.463511 |  0.0 |  0.0 |  1.463511 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.463511 |  0.108755 |  0.0 |  0.0 |  0.0 |  0.0 | -1.463511 |       0.0 |   0.0 |   0.0 |  0.0 | -0.345934 |       0.0 |   0.0 |   0.0 | 0.454688 |  0.03021 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 3.305745 | 1.652872 |  0.0 |  0.0 |  1.536786 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.652872 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.652872 |       0.0 |   0.0 |   0.0 |  0.0 | -0.566251 |       0.0 |   0.0 |   0.0 | 0.450164 |      0.0 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 3.747947 | 1.873973 |  0.0 |  0.0 |   1.53573 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.873973 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.873973 |       0.0 |   0.0 |   0.0 |  0.0 | -0.783929 |       0.0 |   0.0 |   0.0 | 0.445685 |      0.0 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 2.050471 | 1.025236 |  0.0 |  0.0 |  0.564453 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.025236 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.025236 |       0.0 |   0.0 |   0.0 |  0.0 | -0.902033 |       0.0 |   0.0 |   0.0 |  0.44125 |      0.0 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 2.650012 | 1.325006 |  0.0 |  0.0 |  0.809425 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.325006 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.325006 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.95244 |       0.0 |   0.0 |   0.0 |  0.43686 |      0.0 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 2.959048 | 1.479524 |  0.0 |  0.0 |  0.877591 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.479524 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.479524 |       0.0 |   0.0 |   0.0 |  0.0 | -1.034446 |       0.0 |   0.0 |   0.0 | 0.432513 |      0.0 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 0.956604 | 0.478302 |  0.0 |  0.0 | -0.092369 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.238302 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.238302 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.99888 |       0.0 |   0.0 |   0.0 | 0.428209 |      0.0 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 0.731934 | 0.365967 |  0.0 |  0.0 | -0.083051 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.365967 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.365967 |       0.0 |   0.0 |   0.0 |  0.0 | -0.872967 |       0.0 |   0.0 |   0.0 | 0.423949 |      0.0 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 0.454628 | 0.227314 |  0.0 |  0.0 | -0.121034 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.227314 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.227314 |       0.0 |   0.0 |   0.0 |  0.0 | -0.768078 |       0.0 |   0.0 |   0.0 |  0.41973 |      0.0 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 0.300394 | 0.150197 |  0.0 |  0.0 |  0.063243 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  1.409803 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |  1.290681 |  0.119122 |   0.0 |   0.0 |  0.0 | -0.527888 |   0.02538 |   0.0 |   0.0 | 0.415554 |      0.0 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 0.089558 | 0.044779 |  0.0 |  0.0 |  0.044779 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  6.675221 |  1.330493 |  0.0 |  0.0 |  0.0 |  0.0 |  1.850192 |  4.825029 |   0.0 |   0.0 |  0.0 | -0.145837 |  1.064911 |   0.0 |   0.0 | 0.411419 | 0.369581 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 |  0.03977 | 0.019885 |  0.0 |  0.0 |  0.019885 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.460115 |  2.499316 |  0.0 |  0.0 |  0.0 |  0.0 |  1.710992 |  1.749123 |   0.0 |   0.0 |  0.0 |  0.202945 |  1.889046 |   0.0 |   0.0 | 0.407325 | 0.694254 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 | 0.039382 | 0.019691 |  0.0 |  0.0 |  0.019691 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  5.860309 |  3.210825 |  0.0 |  0.0 |  0.0 |  0.0 |  1.829361 |  4.030949 |   0.0 |   0.0 |  0.0 |  0.487393 |  2.320159 |   0.0 |   0.0 | 0.403272 | 0.891896 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 0.039251 | 0.019626 |  0.0 |  0.0 |  0.019626 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 12.700374 |  5.569592 |  0.0 |  0.0 |  0.0 |  0.0 |  1.921262 | 10.779112 |   0.0 |   0.0 |  0.0 |  0.739258 |  4.431075 |   0.0 |   0.0 |  0.39926 | 1.547109 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 |  0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.100505 |  5.810506 |  0.0 |  0.0 |  0.0 |  0.0 |  0.100505 |       0.0 |   0.0 |   0.0 |  0.0 |  0.782998 |  4.632221 |   0.0 |   0.0 | 0.395287 | 1.614029 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 |  0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.820505 |  3.927652 |  0.0 |  0.0 |  0.0 |  0.0 |  0.820505 |       0.0 |   0.0 |   0.0 |  0.0 |  0.726714 |  2.809584 |   0.0 |   0.0 | 0.391354 | 1.091014 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 |  0.03899 | 0.019495 |  0.0 |  0.0 |  0.019495 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.580505 |  3.315832 |  0.0 |  0.0 |  0.0 |  0.0 |   1.72071 |  1.859795 |   0.0 |   0.0 |  0.0 |  0.828023 |  2.100349 |   0.0 |   0.0 |  0.38746 | 0.921064 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.038792 | 0.019396 |  0.0 |  0.0 |  0.019396 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.500604 |   3.16346 |  0.0 |  0.0 |  0.0 |  0.0 |  1.600097 |  0.900507 |   0.0 |   0.0 |  0.0 |  0.978544 |  1.801312 |   0.0 |   0.0 | 0.383605 | 0.878739 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 | 0.038661 |  0.01933 |  0.0 |  0.0 |   0.01933 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  12.46067 |  5.001808 |  0.0 |  0.0 |  0.0 |  0.0 |  1.919747 | 10.540922 |   0.0 |   0.0 |  0.0 |  1.121149 |  3.500872 |   0.0 |   0.0 | 0.379788 | 1.389391 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.038528 | 0.019264 |  0.0 |  0.0 |  0.019264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  4.180736 |   6.16768 |  0.0 |  0.0 |  0.0 |  0.0 |  1.760808 |  2.419928 |   0.0 |   0.0 |  0.0 |  1.251025 |  4.540646 |   0.0 |   0.0 | 0.376009 | 1.713244 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.038396 | 0.019198 |  0.0 |  0.0 |  0.019198 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  4.060802 |  5.397199 |  0.0 |  0.0 |  0.0 |  0.0 |  1.753743 |  2.307059 |   0.0 |   0.0 |  0.0 |  1.342771 |  3.682161 |   0.0 |   0.0 | 0.372267 | 1.499222 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.074919 |  0.03746 |  0.0 |  0.0 |   0.03746 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   1.40254 |   4.41629 |  0.0 |  0.0 |  0.0 |  0.0 |  1.287008 |  0.115532 |   0.0 |   0.0 |  0.0 |  1.373556 |  2.674171 |   0.0 |   0.0 | 0.368563 | 1.226747 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.505845 | 0.252922 |  0.0 |  0.0 |  0.252922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.132922 |  3.232591 |  0.0 |  0.0 |  0.0 |  0.0 | -0.132922 |       0.0 |   0.0 |   0.0 |  0.0 |  1.224886 |  1.642809 |   0.0 |   0.0 | 0.364896 | 0.897942 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 | 1.218215 | 0.609108 |  0.0 |  0.0 |  0.609108 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.609108 |   2.29184 |  0.0 |  0.0 |  0.0 |  0.0 | -0.609108 |       0.0 |   0.0 |   0.0 |  0.0 |   0.93416 |  0.996414 |   0.0 |   0.0 | 0.361265 | 0.636622 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.772303 | 0.386152 |  0.0 |  0.0 |  0.386152 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.386152 |   1.63732 |  0.0 |  0.0 |  0.0 |  0.0 | -0.386152 |       0.0 |   0.0 |   0.0 |  0.0 |  0.675294 |  0.604356 |   0.0 |   0.0 | 0.357671 | 0.454811 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 |   0.9844 |   0.4922 |  0.0 |  0.0 |    0.4922 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   -0.0122 |  1.238581 |  0.0 |  0.0 |  0.0 |  0.0 |   -0.0122 |       0.0 |   0.0 |   0.0 |  0.0 |  0.517909 |   0.36656 |   0.0 |   0.0 | 0.354112 |  0.34405 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 2.486378 | 1.243189 |  0.0 |  0.0 |  1.243189 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.123189 |  0.890686 |  0.0 |  0.0 |  0.0 |  0.0 | -1.123189 |       0.0 |   0.0 |   0.0 |  0.0 |  0.317768 |   0.22233 |   0.0 |   0.0 | 0.350588 | 0.247413 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 | 1.349913 | 0.674957 |  0.0 |  0.0 |  0.674957 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.645043 |  1.214269 |  0.0 |  0.0 |  0.0 |  0.0 |  1.725655 |  1.919389 |   0.0 |   0.0 |  0.0 |  0.323372 |  0.543797 |   0.0 |   0.0 |   0.3471 | 0.337297 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 3.528622 | 1.764311 |  0.0 |  0.0 |  1.764311 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  5.315689 |  2.351913 |  0.0 |  0.0 |  0.0 |  0.0 |  1.811878 |  3.503811 |   0.0 |   0.0 |  0.0 |  0.585638 |   1.42263 |   0.0 |   0.0 | 0.343646 | 0.653309 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 |  1.61841 | 0.809205 |  0.0 |  0.0 |  0.809205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.510795 |  2.521277 |  0.0 |  0.0 |  0.0 |  0.0 |  0.510795 |       0.0 |   0.0 |   0.0 |  0.0 |  0.686066 |  1.494984 |   0.0 |   0.0 | 0.340227 | 0.700355 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.844303 | 0.422151 |  0.0 |  0.0 |  0.422151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 24.417849 |  6.818626 |  0.0 |  0.0 |  0.0 |  0.0 |  1.959046 | 22.458802 |   0.0 |   0.0 |  0.0 |  0.789929 |  5.691856 |   0.0 |   0.0 | 0.336841 | 1.894063 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.895703 | 0.447851 |  0.0 |  0.0 |  0.447851 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 45.032149 |  18.01435 |  0.0 |  0.0 |  0.0 |  0.0 |  1.977794 | 43.054355 |   0.0 |   0.0 |  0.0 |   1.00361 | 16.677251 |   0.0 |   0.0 |  0.33349 | 5.003986 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 1.151139 |  0.57557 |  0.0 |  0.0 |   0.57557 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   9.26443 | 20.955723 |  0.0 |  0.0 |  0.0 |  0.0 |   1.89206 |   7.37237 |   0.0 |   0.0 |  0.0 |   1.17217 | 19.453382 |   0.0 |   0.0 | 0.330172 | 5.821034 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.636581 |  0.31829 |  0.0 |  0.0 |   0.31829 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   4.00171 | 15.225092 |  0.0 |  0.0 |  0.0 |  0.0 |  1.750107 |  2.251603 |   0.0 |   0.0 |  0.0 |  1.289369 | 13.608837 |   0.0 |   0.0 | 0.326886 | 4.229192 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.116642 | 0.058321 |  0.0 |  0.0 |  0.058321 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  8.941679 | 11.872665 |  0.0 |  0.0 |  0.0 |  0.0 |  1.888164 |  7.053515 |   0.0 |   0.0 |  0.0 |  1.385817 | 10.163215 |   0.0 |   0.0 | 0.323634 | 3.297963 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.037049 | 0.018524 |  0.0 |  0.0 |  0.018524 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | 22.181476 | 13.549851 |  0.0 |  0.0 |  0.0 |  0.0 |  1.954917 | 20.226558 |   0.0 |   0.0 |  0.0 |  1.483128 | 11.746309 |   0.0 |   0.0 | 0.320413 | 3.763848 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 |  0.03698 |  0.01849 |  0.0 |  0.0 |   0.01849 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  18.46151 | 16.177406 |  0.0 |  0.0 |  0.0 |  0.0 |  1.945833 | 16.515677 |   0.0 |   0.0 |  0.0 |  1.567799 | 14.292382 |   0.0 |   0.0 | 0.317225 | 4.493724 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.036499 |  0.01825 |  0.0 |  0.0 |   0.01825 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   7.54175 |  14.80036 |  0.0 |  0.0 |  0.0 |  0.0 |  1.867405 |  5.674346 |   0.0 |   0.0 |  0.0 |  1.628979 | 12.857312 |   0.0 |   0.0 | 0.314069 | 4.111211 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 |  0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.262063 | 10.926234 |  0.0 |  0.0 |  0.0 |  0.0 |  1.557926 |  0.704138 |   0.0 |   0.0 |  0.0 |  1.643215 |  8.972076 |   0.0 |   0.0 | 0.310944 | 3.035065 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.035943 | 0.017972 |  0.0 |  0.0 |  0.017972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  5.862028 |  8.389096 |  0.0 |  0.0 |  0.0 |  0.0 |  1.829411 |  4.032618 |   0.0 |   0.0 |  0.0 |   1.65318 |  6.428066 |   0.0 |   0.0 |  0.30785 | 2.330304 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.035873 | 0.017937 |  0.0 |  0.0 |  0.017937 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  3.222063 |  6.929658 |  0.0 |  0.0 |  0.0 |  0.0 |   1.68964 |  1.532424 |   0.0 |   0.0 |  0.0 |  1.672035 |  4.952836 |   0.0 |   0.0 | 0.304787 | 1.924905 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.0 |  0.0 |  0.017761 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.582239 |  5.153776 |  0.0 |  0.0 |  0.0 |  0.0 |  0.582239 |       0.0 |   0.0 |   0.0 |  0.0 |  1.571514 |  3.280508 |   0.0 |   0.0 | 0.301754 | 1.431605 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.0 |  0.0 |  0.017831 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.222169 |  3.646947 |  0.0 |  0.0 |  0.0 |  0.0 |  0.222169 |       0.0 |   0.0 |   0.0 |  0.0 |  1.358467 |  1.989729 |   0.0 |   0.0 | 0.298752 | 1.013041 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.0 |  0.0 |  0.018041 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.581959 |  2.688797 |  0.0 |  0.0 |  0.0 |  0.0 |  0.581959 |       0.0 |   0.0 |   0.0 |  0.0 |  1.186187 |  1.206832 |   0.0 |   0.0 | 0.295779 | 0.746888 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.036637 | 0.018319 |  0.0 |  0.0 |  0.018319 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.861681 |  2.459597 |  0.0 |  0.0 |  0.0 |  0.0 |  1.650555 |  1.211126 |   0.0 |   0.0 |  0.0 |  1.176737 |  0.990025 |   0.0 |   0.0 | 0.292836 | 0.683221 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.061944 | 0.030972 |  0.0 |  0.0 |  0.030972 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.449028 |  2.258997 |  0.0 |  0.0 |  0.0 |  0.0 |  0.449028 |       0.0 |   0.0 |   0.0 |  0.0 |  1.150098 |  0.818977 |   0.0 |   0.0 | 0.289922 | 0.627499 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.0 |  0.0 |  0.094074 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.145926 |  1.778401 |  0.0 |  0.0 |  0.0 |  0.0 |  0.145926 |       0.0 |   0.0 |   0.0 |  0.0 |  0.994629 |  0.496735 |   0.0 |   0.0 | 0.287037 |    0.494 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.46949 | 0.234745 |  0.0 |  0.0 |  0.234745 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.234745 |    1.3906 |  0.0 |  0.0 |  0.0 |  0.0 | -0.234745 |       0.0 |   0.0 |   0.0 |  0.0 |  0.805134 |  0.301285 |   0.0 |   0.0 | 0.284181 | 0.386278 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 1.680918 | 0.840459 |  0.0 |  0.0 |  0.840459 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.840459 |     1.024 |  0.0 |  0.0 |  0.0 |  0.0 | -0.840459 |       0.0 |   0.0 |   0.0 |  0.0 |  0.559908 |  0.182738 |   0.0 |   0.0 | 0.281354 | 0.284445 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 1.743886 | 0.871943 |  0.0 |  0.0 |  0.871943 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.511943 |  0.726222 |  0.0 |  0.0 |  0.0 |  0.0 | -0.511943 |       0.0 |   0.0 |   0.0 |  0.0 |  0.336832 |  0.110837 |   0.0 |   0.0 | 0.278554 | 0.201728 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 2.122301 | 1.061151 |  0.0 |  0.0 |  1.061151 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  2.058849 |  0.831772 |  0.0 |  0.0 |  0.0 |  0.0 |  1.514292 |  0.544558 |   0.0 |   0.0 |  0.0 |  0.372739 |   0.18325 |   0.0 |   0.0 | 0.275782 | 0.231048 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 2.150411 | 1.075205 |  0.0 |  0.0 |  1.075205 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.235205 |  0.898248 |  0.0 |  0.0 |  0.0 |  0.0 | -0.235205 |       0.0 |   0.0 |   0.0 |  0.0 |  0.415821 |  0.209389 |   0.0 |   0.0 | 0.273038 | 0.249513 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 1.863566 | 0.931783 |  0.0 |  0.0 |  0.931783 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.571783 |  0.663611 |  0.0 |  0.0 |  0.0 |  0.0 | -0.571783 |       0.0 |   0.0 |   0.0 |  0.0 |  0.266288 |  0.127001 |   0.0 |   0.0 | 0.270322 | 0.184336 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 3.115838 | 1.557919 |  0.0 |  0.0 |  1.557919 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.197919 |  0.400393 |  0.0 |  0.0 |  0.0 |  0.0 | -1.197919 |       0.0 |   0.0 |   0.0 |  0.0 |  0.055731 |   0.07703 |   0.0 |   0.0 | 0.267632 |  0.11122 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 1.940627 | 0.970313 |  0.0 |  0.0 |  0.970313 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.970313 |  0.161489 |  0.0 |  0.0 |  0.0 |  0.0 | -0.970313 |       0.0 |   0.0 |   0.0 |  0.0 | -0.150201 |  0.046721 |   0.0 |   0.0 | 0.264969 | 0.044858 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 2.122768 | 1.061384 |  0.0 |  0.0 |  1.044663 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.061384 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.061384 |       0.0 |   0.0 |   0.0 |  0.0 | -0.307391 |  0.028338 |   0.0 |   0.0 | 0.262332 |      0.0 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 1.314414 | 0.657207 |  0.0 |  0.0 |  0.527903 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.657207 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.657207 |       0.0 |   0.0 |   0.0 |  0.0 | -0.406214 |  0.017188 |   0.0 |   0.0 | 0.259722 |      0.0 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.602486 | 0.301243 |  0.0 |  0.0 |  0.150432 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.301243 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.301243 |       0.0 |   0.0 |   0.0 |  0.0 | -0.418374 |  0.010425 |   0.0 |   0.0 | 0.257138 |      0.0 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.109905 | 0.054952 |  0.0 |  0.0 | -0.058221 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.054952 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.054952 |       0.0 |   0.0 |   0.0 |  0.0 | -0.374076 |  0.006323 |   0.0 |   0.0 | 0.254579 |      0.0 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.035026 | 0.017513 |  0.0 |  0.0 | -0.039328 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017513 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017513 |       0.0 |   0.0 |   0.0 |  0.0 | -0.312722 |  0.003835 |   0.0 |   0.0 | 0.252046 |      0.0 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 |  0.009842 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017154 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017154 |       0.0 |   0.0 |   0.0 |  0.0 | -0.259176 |  0.002326 |   0.0 |   0.0 | 0.249538 |      0.0 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.033727 | 0.016863 |  0.0 |  0.0 |  0.016863 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016863 |  0.033188 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016863 |       0.0 |   0.0 |   0.0 |  0.0 | -0.215278 |  0.001411 |   0.0 |   0.0 | 0.247055 | 0.009219 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.033286 | 0.016643 |  0.0 |  0.0 |  0.016643 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016643 |  0.066162 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016643 |       0.0 |   0.0 |   0.0 |  0.0 | -0.179291 |  0.000856 |   0.0 |   0.0 | 0.244597 | 0.018378 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.032916 | 0.016458 |  0.0 |  0.0 |  0.016458 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016458 |  0.092892 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016458 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.14979 |  0.000519 |   0.0 |   0.0 | 0.242163 | 0.025803 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 |    0.0169 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   -0.0169 |  0.114406 |  0.0 |  0.0 |  0.0 |  0.0 |   -0.0169 |       0.0 |   0.0 |   0.0 |  0.0 | -0.125663 |  0.000315 |   0.0 |   0.0 | 0.239754 | 0.031779 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 |  0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016973 |  0.131605 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016973 |       0.0 |   0.0 |   0.0 |  0.0 | -0.105954 |  0.000191 |   0.0 |   0.0 | 0.237368 | 0.036557 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.033434 | 0.016717 |  0.0 |  0.0 |  0.016717 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  1.543283 |  0.314258 |  0.0 |  0.0 |  0.0 |  0.0 |  1.352031 |  0.191252 |   0.0 |   0.0 |  0.0 |  0.038388 |  0.040864 |   0.0 |   0.0 | 0.235006 | 0.087294 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 |  0.03336 |  0.01668 |  0.0 |  0.0 |   0.01668 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.01668 |  0.440283 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.01668 |       0.0 |   0.0 |   0.0 |  0.0 |  0.148326 |  0.059289 |   0.0 |   0.0 | 0.232668 | 0.122301 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 |  0.016973 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016973 |  0.384701 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016973 |       0.0 |   0.0 |   0.0 |  0.0 |  0.118388 |  0.035961 |   0.0 |   0.0 | 0.230353 | 0.106861 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.124092 | 0.062046 |  0.0 |  0.0 |  0.062046 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.062046 |  0.339502 |  0.0 |  0.0 |  0.0 |  0.0 | -0.062046 |       0.0 |   0.0 |   0.0 |  0.0 |   0.08963 |  0.021811 |   0.0 |   0.0 | 0.228061 | 0.094306 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.0 |  0.0 |  0.278392 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  0.561608 |  0.359564 |  0.0 |  0.0 |  0.0 |  0.0 |  0.561608 |       0.0 |   0.0 |   0.0 |  0.0 |  0.120543 |  0.013229 |   0.0 |   0.0 | 0.225792 | 0.099879 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 |  1.27835 | 0.639175 |  0.0 |  0.0 |  0.639175 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.159175 |   0.36456 |  0.0 |  0.0 |  0.0 |  0.0 | -0.159175 |       0.0 |   0.0 |   0.0 |  0.0 |  0.132991 |  0.008024 |   0.0 |   0.0 | 0.223545 | 0.101267 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 |  2.07666 |  1.03833 |  0.0 |  0.0 |   1.03833 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.91833 |   0.23512 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.91833 |       0.0 |   0.0 |   0.0 |  0.0 |  0.008932 |  0.004867 |   0.0 |   0.0 | 0.221321 | 0.065311 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 | 2.862014 | 1.431007 |  0.0 |  0.0 |  1.431007 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.951007 |  0.059858 |  0.0 |  0.0 |  0.0 |  0.0 | -0.951007 |       0.0 |   0.0 |   0.0 |  0.0 | -0.162212 |  0.002952 |   0.0 |   0.0 | 0.219118 | 0.016627 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 3.356573 | 1.678286 |  0.0 |  0.0 |  1.523706 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.678286 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.678286 |       0.0 |   0.0 |   0.0 |  0.0 | -0.373309 |   0.00179 |   0.0 |   0.0 | 0.216938 |      0.0 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 3.356514 | 1.678257 |  0.0 |  0.0 |  1.284264 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.678257 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.678257 |       0.0 |   0.0 |   0.0 |  0.0 | -0.609858 |  0.001086 |   0.0 |   0.0 |  0.21478 |      0.0 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 4.286095 | 2.143048 |  0.0 |  0.0 |  1.509293 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -2.143048 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -2.143048 |       0.0 |   0.0 |   0.0 |  0.0 | -0.847056 |  0.000659 |   0.0 |   0.0 | 0.212642 |      0.0 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 3.753358 | 1.876679 |  0.0 |  0.0 |  1.030572 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.876679 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.876679 |       0.0 |   0.0 |   0.0 |  0.0 | -1.057033 |  0.000399 |   0.0 |   0.0 | 0.210527 |      0.0 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 3.144766 | 1.572383 |  0.0 |  0.0 |  0.603946 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.572383 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.572383 |       0.0 |   0.0 |   0.0 |  0.0 | -1.177111 |  0.000242 |   0.0 |   0.0 | 0.208432 |      0.0 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 2.519332 | 1.259666 |  0.0 |  0.0 |  0.246696 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -1.259666 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -1.259666 |       0.0 |   0.0 |   0.0 |  0.0 | -1.219474 |  0.000147 |   0.0 |   0.0 | 0.206358 |      0.0 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.179366 | 0.589683 |  0.0 |  0.0 | -0.369936 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.589683 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.589683 |       0.0 |   0.0 |   0.0 |  0.0 | -1.164013 |  0.000089 |   0.0 |   0.0 | 0.204305 |      0.0 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 0.523693 | 0.261846 |  0.0 |  0.0 |  -0.56503 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.261846 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.261846 |       0.0 |   0.0 |   0.0 |  0.0 | -1.029202 |  0.000054 |   0.0 |   0.0 | 0.202272 |      0.0 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 |  0.13182 |  0.06591 |  0.0 |  0.0 | -0.605552 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |  -0.06591 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |  -0.06591 |       0.0 |   0.0 |   0.0 |  0.0 | -0.871754 |  0.000033 |   0.0 |   0.0 | 0.200259 |      0.0 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 0.035803 | 0.017902 |  0.0 |  0.0 | -0.504995 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017902 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017902 |       0.0 |   0.0 |   0.0 |  0.0 | -0.721183 |   0.00002 |   0.0 |   0.0 | 0.198267 |      0.0 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |  0.0 |  0.0 |  -0.38017 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.017154 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.017154 |       0.0 |   0.0 |   0.0 |  0.0 |  -0.59363 |  0.000012 |   0.0 |   0.0 | 0.196294 |      0.0 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |  0.0 |  0.0 | -0.277861 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 |   -0.0169 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 |   -0.0169 |       0.0 |   0.0 |   0.0 |  0.0 | -0.489109 |  0.000007 |   0.0 |   0.0 | 0.194341 |      0.0 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |  0.0 |  0.0 | -0.194134 | 0.0 |  0.0 |  0.0 |  0.0 | 0.0 |  0.0 |  0.0 | 0.0 | -0.016973 |       0.0 |  0.0 |  0.0 |  0.0 |  0.0 | -0.016973 |       0.0 |   0.0 |   0.0 |  0.0 | -0.403518 |  0.000004 |   0.0 |   0.0 | 0.192407 |      0.0 |

    .. raw:: html

        <iframe
            src="lland_v2_ex4.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 5 <lland_v1_ex5>`

    The following calculation shows, that the outflow values of the
    integration test for sealed areas (|VERS|) are reproduced exactly:

    >>> lnk(VERS)
    >>> test('lland_v2_ex5')
    |   date | nied | teml |       pet |  nkor | tkor |      et0 |     evpo |      nbes | sbes |      evi | evb |      wgtf | schm |      wada |       qdb | qib1 | qib2 | qbb |      qdgz |         q |     inzp | wats | waes | bowa |    qdgz1 |     qdgz2 | qigz1 | qigz2 | qbgz |    qdga1 |     qdga2 | qiga1 | qiga2 |     qbga |   outlet |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 | 21.2 |  0.100707 |   0.0 | 22.0 | 0.040283 | 0.020141 |       0.0 |  0.0 |      0.0 | 0.0 | 11.275777 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.497508 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.497508 | 0.138197 |
    | 01.01. |  0.0 | 19.4 |  0.097801 |   0.0 | 20.2 |  0.03912 |  0.01956 |       0.0 |  0.0 |      0.0 | 0.0 | 10.353214 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.492558 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.492558 | 0.136822 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.0 | 10.096946 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.487657 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.487657 |  0.13546 |
    | 01.01. |  0.0 | 18.3 |   0.09599 |   0.0 | 19.1 | 0.038396 | 0.019198 |       0.0 |  0.0 |      0.0 | 0.0 |  9.789425 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.482805 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.482805 | 0.134112 |
    | 01.01. |  0.0 | 18.9 |  0.096981 |   0.0 | 19.7 | 0.038792 | 0.019396 |       0.0 |  0.0 |      0.0 | 0.0 | 10.096946 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.478001 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.478001 | 0.132778 |
    | 01.01. |  0.0 | 22.5 |  0.102761 |   0.0 | 23.3 | 0.041104 | 0.020552 |       0.0 |  0.0 |      0.0 | 0.0 | 11.942073 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.473245 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.473245 | 0.131457 |
    | 01.01. |  0.0 | 25.1 |  0.291908 |   0.0 | 25.9 | 0.116763 | 0.058382 |       0.0 |  0.0 |      0.0 | 0.0 | 13.274665 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.468536 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.468536 | 0.130149 |
    | 01.01. |  0.0 | 28.3 |  1.932875 |   0.0 | 29.1 |  0.77315 | 0.386575 |       0.0 |  0.0 |      0.0 | 0.0 | 14.914778 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.463874 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.463874 | 0.128854 |
    | 01.01. |  0.0 | 27.8 |  4.369536 |   0.0 | 28.6 | 1.747814 | 0.873907 |       0.0 |  0.0 |      0.0 | 0.0 |  14.65851 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.459258 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.459258 | 0.127572 |
    | 01.01. |  0.0 | 31.4 |  7.317556 |   0.0 | 32.2 | 2.927022 | 1.463511 |       0.0 |  0.0 |      0.0 | 0.0 | 16.503638 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.454688 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.454688 | 0.126302 |
    | 01.01. |  0.0 | 32.2 |  8.264362 |   0.0 | 33.0 | 3.305745 | 1.652872 |       0.0 |  0.0 |      0.0 | 0.0 | 16.913666 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.450164 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.450164 | 0.125046 |
    | 01.01. |  0.0 | 35.2 |  9.369867 |   0.0 | 36.0 | 3.747947 | 1.873973 |       0.0 |  0.0 |      0.0 | 0.0 | 18.451272 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.445685 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.445685 | 0.123801 |
    | 01.01. |  0.0 | 37.1 |  5.126178 |   0.0 | 37.9 | 2.050471 | 1.025236 |       0.0 |  0.0 |      0.0 | 0.0 | 19.425089 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.44125 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.44125 |  0.12257 |
    | 01.01. |  0.0 | 31.2 |   6.62503 |   0.0 | 32.0 | 2.650012 | 1.325006 |       0.0 |  0.0 |      0.0 | 0.0 | 16.401131 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.43686 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.43686 |  0.12135 |
    | 01.01. |  0.0 | 24.3 |  7.397619 |   0.0 | 25.1 | 2.959048 | 1.479524 |       0.0 |  0.0 |      0.0 | 0.0 | 12.864637 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.432513 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.432513 | 0.120142 |
    | 01.01. |  0.2 | 25.4 |   2.39151 |  0.24 | 26.2 | 0.956604 | 0.478302 |       0.0 |  0.0 |     0.24 | 0.0 | 13.428426 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.428209 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.428209 | 0.118947 |
    | 01.01. |  0.0 | 25.9 |  1.829834 |   0.0 | 26.7 | 0.731934 | 0.365967 |       0.0 |  0.0 |      0.0 | 0.0 | 13.684693 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.423949 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 | 0.423949 | 0.117764 |
    | 01.01. |  0.0 | 23.7 |  1.136569 |   0.0 | 24.5 | 0.454628 | 0.227314 |       0.0 |  0.0 |      0.0 | 0.0 | 12.557116 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.41973 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.41973 | 0.116592 |
    | 01.01. |  1.3 | 21.6 |  0.750986 |  1.56 | 22.4 | 0.300394 | 0.150197 |      0.76 |  0.0 | 0.150197 | 0.0 | 11.480791 |  0.0 |      0.76 |      0.76 |  0.0 |  0.0 | 0.0 |      0.76 |  0.486731 | 0.649803 |  0.0 |  0.0 |  0.0 |     0.76 |       0.0 |   0.0 |   0.0 |  0.0 | 0.071177 |       0.0 |   0.0 |   0.0 | 0.415554 | 0.135203 |
    | 01.01. |  5.6 | 21.2 |  0.223895 |  6.72 | 22.0 | 0.089558 | 0.044779 |  6.569803 |  0.0 | 0.044779 | 0.0 | 11.275777 |  0.0 |  6.569803 |  6.569803 |  0.0 |  0.0 | 0.0 |  6.569803 |  1.715412 | 0.755221 |  0.0 |  0.0 |  0.0 | 1.847788 |  4.722014 |   0.0 |   0.0 |  0.0 | 0.297915 |  1.006079 |   0.0 |   0.0 | 0.411419 | 0.476503 |
    | 01.01. |  2.9 | 20.4 |  0.099425 |  3.48 | 21.2 |  0.03977 | 0.019885 |  3.435221 |  0.0 | 0.019885 | 0.0 | 10.865749 |  0.0 |  3.435221 |  3.435221 |  0.0 |  0.0 | 0.0 |  3.435221 |  2.803096 | 0.780115 |  0.0 |  0.0 |  0.0 | 1.708898 |  1.726323 |   0.0 |   0.0 |  0.0 | 0.565852 |  1.829919 |   0.0 |   0.0 | 0.407325 | 0.778638 |
    | 01.01. |  4.9 | 19.8 |  0.098454 |  5.88 | 20.6 | 0.039382 | 0.019691 |  5.860115 |  0.0 | 0.019691 | 0.0 | 10.558228 |  0.0 |  5.860115 |  5.860115 |  0.0 |  0.0 | 0.0 |  5.860115 |  3.467748 | 0.780309 |  0.0 |  0.0 |  0.0 | 1.829355 |   4.03076 |   0.0 |   0.0 |  0.0 | 0.784332 |  2.280144 |   0.0 |   0.0 | 0.403272 | 0.963263 |
    | 01.01. | 10.6 | 19.6 |  0.098128 | 12.72 | 20.4 | 0.039251 | 0.019626 | 12.700309 |  0.0 | 0.019626 | 0.0 | 10.455721 |  0.0 | 12.700309 | 12.700309 |  0.0 |  0.0 | 0.0 | 12.700309 |  5.788386 | 0.780374 |  0.0 |  0.0 |  0.0 | 1.921262 | 10.779047 |   0.0 |   0.0 |  0.0 |  0.98237 |  4.406757 |   0.0 |   0.0 |  0.39926 | 1.607885 |
    | 01.01. |  0.1 | 19.2 |  0.097474 |  0.12 | 20.0 |  0.03899 | 0.019495 |  0.100374 |  0.0 | 0.019495 | 0.0 | 10.250707 |  0.0 |  0.100374 |  0.100374 |  0.0 |  0.0 | 0.0 |  0.100374 |  5.994776 | 0.780505 |  0.0 |  0.0 |  0.0 | 0.100374 |       0.0 |   0.0 |   0.0 |  0.0 | 0.982029 |   4.61746 |   0.0 |   0.0 | 0.395287 | 1.665216 |
    | 02.01. |  0.7 | 19.2 |  0.097474 |  0.84 | 20.0 |  0.03899 | 0.019495 |  0.820505 |  0.0 | 0.019495 | 0.0 | 10.250707 |  0.0 |  0.820505 |  0.820505 |  0.0 |  0.0 | 0.0 |  0.820505 |   4.08164 | 0.780505 |  0.0 |  0.0 |  0.0 | 0.820505 |       0.0 |   0.0 |   0.0 |  0.0 | 0.889655 |  2.800631 |   0.0 |   0.0 | 0.391354 | 1.133789 |
    | 02.01. |  3.0 | 19.2 |  0.097474 |   3.6 | 20.0 |  0.03899 | 0.019495 |  3.580505 |  0.0 | 0.019495 | 0.0 | 10.250707 |  0.0 |  3.580505 |  3.580505 |  0.0 |  0.0 | 0.0 |  3.580505 |  3.443807 | 0.780505 |  0.0 |  0.0 |  0.0 |  1.72071 |  1.859795 |   0.0 |   0.0 |  0.0 | 0.961428 |  2.094919 |   0.0 |   0.0 |  0.38746 | 0.956613 |
    | 02.01. |  2.1 | 18.9 |  0.096981 |  2.52 | 19.7 | 0.038792 | 0.019396 |  2.500505 |  0.0 | 0.019396 | 0.0 | 10.096946 |  0.0 |  2.500505 |  2.500505 |  0.0 |  0.0 | 0.0 |  2.500505 |   3.26937 | 0.780604 |  0.0 |  0.0 |  0.0 | 1.600081 |  0.900424 |   0.0 |   0.0 |  0.0 | 1.087765 |     1.798 |   0.0 |   0.0 | 0.383605 | 0.908158 |
    | 02.01. | 10.4 | 18.7 |  0.096652 | 12.48 | 19.5 | 0.038661 |  0.01933 | 12.460604 |  0.0 |  0.01933 | 0.0 |  9.994439 |  0.0 | 12.460604 | 12.460604 |  0.0 |  0.0 | 0.0 | 12.460604 |  5.089193 |  0.78067 |  0.0 |  0.0 |  0.0 | 1.919747 | 10.540857 |   0.0 |   0.0 |  0.0 |  1.21057 |  3.498835 |   0.0 |   0.0 | 0.379788 | 1.413665 |
    | 02.01. |  3.5 | 18.5 |  0.096321 |   4.2 | 19.3 | 0.038528 | 0.019264 |   4.18067 |  0.0 | 0.019264 | 0.0 |  9.891932 |  0.0 |   4.18067 |   4.18067 |  0.0 |  0.0 | 0.0 |   4.18067 |  6.239631 | 0.780736 |  0.0 |  0.0 |  0.0 | 1.760804 |  2.419866 |   0.0 |   0.0 |  0.0 | 1.324236 |  4.539386 |   0.0 |   0.0 | 0.376009 | 1.733231 |
    | 02.01. |  3.4 | 18.3 |   0.09599 |  4.08 | 19.1 | 0.038396 | 0.019198 |  4.060736 |  0.0 | 0.019198 | 0.0 |  9.789425 |  0.0 |  4.060736 |  4.060736 |  0.0 |  0.0 | 0.0 |  4.060736 |   5.45635 | 0.780802 |  0.0 |  0.0 |  0.0 | 1.753739 |  2.306997 |   0.0 |   0.0 |  0.0 | 1.402711 |  3.681371 |   0.0 |   0.0 | 0.372267 | 1.515653 |
    | 02.01. |  1.2 | 18.5 |  0.187298 |  1.44 | 19.3 | 0.074919 |  0.03746 |  1.420802 |  0.0 |  0.03746 | 0.0 |  9.891932 |  0.0 |  1.420802 |  1.420802 |  0.0 |  0.0 | 0.0 |  1.420802 |  4.467671 |  0.76254 |  0.0 |  0.0 |  0.0 | 1.296172 |   0.12463 |   0.0 |   0.0 |  0.0 | 1.423489 |  2.675619 |   0.0 |   0.0 | 0.368563 |  1.24102 |
    | 02.01. |  0.1 | 18.8 |  1.264612 |  0.12 | 19.6 | 0.505845 | 0.252922 |   0.08254 |  0.0 | 0.252922 | 0.0 | 10.045692 |  0.0 |   0.08254 |   0.08254 |  0.0 |  0.0 | 0.0 |   0.08254 |  3.296974 | 0.547078 |  0.0 |  0.0 |  0.0 |  0.08254 |       0.0 |   0.0 |   0.0 |  0.0 | 1.286749 |  1.645329 |   0.0 |   0.0 | 0.364896 | 0.915826 |
    | 02.01. |  0.0 | 18.8 |  3.045538 |   0.0 | 19.6 | 1.218215 | 0.609108 |       0.0 |  0.0 | 0.547078 | 0.0 | 10.045692 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  2.419941 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 1.060733 |  0.997943 |   0.0 |   0.0 | 0.361265 | 0.672206 |
    | 02.01. |  0.0 | 19.0 |  1.930758 |   0.0 | 19.8 | 0.772303 | 0.386152 |       0.0 |  0.0 |      0.0 | 0.0 |   10.1482 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.831408 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.868455 |  0.605283 |   0.0 |   0.0 | 0.357671 | 0.508724 |
    | 02.01. |  0.4 | 19.2 |  2.461001 |  0.48 | 20.0 |   0.9844 |   0.4922 |       0.0 |  0.0 |     0.48 | 0.0 | 10.250707 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.432265 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |  0.71103 |  0.367123 |   0.0 |   0.0 | 0.354112 | 0.397851 |
    | 02.01. |  0.1 | 19.3 |  6.215945 |  0.12 | 20.1 | 2.486378 | 1.243189 |       0.0 |  0.0 |     0.12 | 0.0 |  10.30196 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.155402 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.582143 |  0.222671 |   0.0 |   0.0 | 0.350588 | 0.320945 |
    | 02.01. |  3.6 | 19.0 |  3.374783 |  4.32 | 19.8 | 1.349913 | 0.674957 |      3.52 |  0.0 | 0.674957 | 0.0 |   10.1482 |  0.0 |      3.52 |      3.52 |  0.0 |  0.0 | 0.0 |      3.52 |  1.503858 | 0.125043 |  0.0 |  0.0 |  0.0 | 1.715909 |  1.804091 |   0.0 |   0.0 |  0.0 | 0.637319 |  0.519439 |   0.0 |   0.0 |   0.3471 | 0.417738 |
    | 02.01. |  5.9 | 18.8 |  8.821555 |  7.08 | 19.6 | 3.528622 | 1.764311 |  6.405043 |  0.0 |      0.8 | 0.0 | 10.045692 |  0.0 |  6.405043 |  6.405043 |  0.0 |  0.0 | 0.0 |  6.405043 |  2.800802 |      0.0 |  0.0 |  0.0 |  0.0 | 1.843873 |   4.56117 |   0.0 |   0.0 |  0.0 | 0.844819 |  1.612337 |   0.0 |   0.0 | 0.343646 | 0.778001 |
    | 02.01. |  1.1 | 18.7 |  4.046025 |  1.32 | 19.5 |  1.61841 | 0.809205 |      0.52 |  0.0 |      0.8 | 0.0 |  9.994439 |  0.0 |      0.52 |      0.52 |  0.0 |  0.0 | 0.0 |      0.52 |  3.042961 |      0.0 |  0.0 |  0.0 |  0.0 |     0.52 |       0.0 |   0.0 |   0.0 |  0.0 | 0.901931 |  1.800804 |   0.0 |   0.0 | 0.340227 | 0.845267 |
    | 02.01. | 20.7 | 17.8 |  2.110757 | 24.84 | 18.6 | 0.844303 | 0.422151 |     24.04 |  0.0 | 0.422151 | 0.0 |  9.533157 |  0.0 |     24.04 |     24.04 |  0.0 |  0.0 | 0.0 |     24.04 |  7.101229 | 0.377849 |  0.0 |  0.0 |  0.0 | 1.958403 | 22.081597 |   0.0 |   0.0 |  0.0 |  0.96741 |  5.796977 |   0.0 |   0.0 | 0.336841 | 1.972564 |
    | 02.01. | 37.9 | 17.4 |  2.239257 | 45.48 | 18.2 | 0.895703 | 0.447851 | 45.057849 |  0.0 | 0.447851 | 0.0 |  9.328143 |  0.0 | 45.057849 | 45.057849 |  0.0 |  0.0 | 0.0 | 45.057849 | 18.160786 | 0.352149 |  0.0 |  0.0 |  0.0 | 1.977806 | 43.080042 |   0.0 |   0.0 |  0.0 | 1.148864 | 16.678432 |   0.0 |   0.0 |  0.33349 | 5.044663 |
    | 02.01. |  8.2 | 17.3 |  2.877848 |  9.84 | 18.1 | 1.151139 |  0.57557 |  9.392149 |  0.0 |  0.57557 | 0.0 |  9.276889 |  0.0 |  9.392149 |  9.392149 |  0.0 |  0.0 | 0.0 |  9.392149 | 21.107036 |  0.22443 |  0.0 |  0.0 |  0.0 | 1.893528 |  7.498621 |   0.0 |   0.0 |  0.0 | 1.291233 | 19.485632 |   0.0 |   0.0 | 0.330172 | 5.863066 |
    | 02.01. |  3.6 | 16.8 |  1.591452 |  4.32 | 17.6 | 0.636581 |  0.31829 |   3.74443 |  0.0 |  0.31829 | 0.0 |  9.020622 |  0.0 |   3.74443 |   3.74443 |  0.0 |  0.0 | 0.0 |   3.74443 | 15.312272 |  0.48171 |  0.0 |  0.0 |  0.0 | 1.732937 |  2.011494 |   0.0 |   0.0 |  0.0 |  1.38537 | 13.600016 |   0.0 |   0.0 | 0.326886 | 4.253409 |
    | 02.01. |  7.5 | 16.5 |  0.291604 |   9.0 | 17.3 | 0.116642 | 0.058321 |   8.68171 |  0.0 | 0.058321 | 0.0 |  8.866861 |  0.0 |   8.68171 |   8.68171 |  0.0 |  0.0 | 0.0 |   8.68171 | 11.846103 | 0.741679 |  0.0 |  0.0 |  0.0 | 1.884815 |  6.796894 |   0.0 |   0.0 |  0.0 | 1.462598 | 10.059871 |   0.0 |   0.0 | 0.323634 | 3.290584 |
    | 02.01. | 18.5 | 16.3 |  0.092622 |  22.2 | 17.1 | 0.037049 | 0.018524 | 22.141679 |  0.0 | 0.018524 | 0.0 |  8.764354 |  0.0 | 22.141679 | 22.141679 |  0.0 |  0.0 | 0.0 | 22.141679 | 13.494974 | 0.781476 |  0.0 |  0.0 |  0.0 | 1.954836 | 20.186843 |   0.0 |   0.0 |  0.0 |  1.54569 |  11.62887 |   0.0 |   0.0 | 0.320413 | 3.748604 |
    | 02.01. | 15.4 | 16.2 |  0.092451 | 18.48 | 17.0 |  0.03698 |  0.01849 | 18.461476 |  0.0 |  0.01849 | 0.0 |  8.713101 |  0.0 | 18.461476 | 18.461476 |  0.0 |  0.0 | 0.0 | 18.461476 | 16.150217 |  0.78151 |  0.0 |  0.0 |  0.0 | 1.945833 | 16.515642 |   0.0 |   0.0 |  0.0 | 1.619013 | 14.213979 |   0.0 |   0.0 | 0.317225 | 4.486171 |
    | 02.01. |  6.3 | 15.5 |  0.091248 |  7.56 | 16.3 | 0.036499 |  0.01825 |   7.54151 |  0.0 |  0.01825 | 0.0 |  8.354326 |  0.0 |   7.54151 |   7.54151 |  0.0 |  0.0 | 0.0 |   7.54151 |  14.79468 |  0.78175 |  0.0 |  0.0 |  0.0 | 1.867401 |  5.674109 |   0.0 |   0.0 |  0.0 |  1.67091 | 12.809702 |   0.0 |   0.0 | 0.314069 | 4.109633 |
    | 02.01. |  1.9 | 14.6 |  0.089683 |  2.28 | 15.4 | 0.035873 | 0.017937 |   2.26175 |  0.0 | 0.017937 | 0.0 |  7.893044 |  0.0 |   2.26175 |   2.26175 |  0.0 |  0.0 | 0.0 |   2.26175 | 10.931585 | 0.782063 |  0.0 |  0.0 |  0.0 | 1.557865 |  0.703886 |   0.0 |   0.0 |  0.0 | 1.677538 |  8.943103 |   0.0 |   0.0 | 0.310944 | 3.036551 |
    | 03.01. |  4.9 | 14.7 |  0.089858 |  5.88 | 15.5 | 0.035943 | 0.017972 |  5.862063 |  0.0 | 0.017972 | 0.0 |  7.944298 |  0.0 |  5.862063 |  5.862063 |  0.0 |  0.0 | 0.0 |  5.862063 |  8.399581 | 0.782028 |  0.0 |  0.0 |  0.0 | 1.829412 |  4.032652 |   0.0 |   0.0 |  0.0 | 1.681277 |  6.410455 |   0.0 |   0.0 |  0.30785 | 2.333217 |
    | 03.01. |  2.7 | 14.6 |  0.089683 |  3.24 | 15.4 | 0.035873 | 0.017937 |  3.222028 |  0.0 | 0.017937 | 0.0 |  7.893044 |  0.0 |  3.222028 |  3.222028 |  0.0 |  0.0 | 0.0 |  3.222028 |  6.941979 | 0.782063 |  0.0 |  0.0 |  0.0 | 1.689637 |  1.532392 |   0.0 |   0.0 |  0.0 | 1.695038 |  4.942153 |   0.0 |   0.0 | 0.304787 | 1.928327 |
    | 03.01. |  0.5 | 14.1 |  0.088805 |   0.6 | 14.9 | 0.035522 | 0.017761 |  0.582063 |  0.0 | 0.017761 | 0.0 |  7.636776 |  0.0 |  0.582063 |  0.582063 |  0.0 |  0.0 | 0.0 |  0.582063 |  5.166108 | 0.782239 |  0.0 |  0.0 |  0.0 | 0.582063 |       0.0 |   0.0 |   0.0 |  0.0 | 1.590331 |  3.274023 |   0.0 |   0.0 | 0.301754 |  1.43503 |
    | 03.01. |  0.2 | 14.3 |  0.089157 |  0.24 | 15.1 | 0.035663 | 0.017831 |  0.222239 |  0.0 | 0.017831 | 0.0 |  7.739283 |  0.0 |  0.222239 |  0.222239 |  0.0 |  0.0 | 0.0 |  0.222239 |  3.658411 | 0.782169 |  0.0 |  0.0 |  0.0 | 0.222239 |       0.0 |   0.0 |   0.0 |  0.0 | 1.373864 |  1.985796 |   0.0 |   0.0 | 0.298752 | 1.016225 |
    | 03.01. |  0.5 | 14.9 |  0.090207 |   0.6 | 15.7 | 0.036083 | 0.018041 |  0.582169 |  0.0 | 0.018041 | 0.0 |  8.046805 |  0.0 |  0.582169 |  0.582169 |  0.0 |  0.0 | 0.0 |  0.582169 |  2.699043 | 0.781959 |  0.0 |  0.0 |  0.0 | 0.582169 |       0.0 |   0.0 |   0.0 |  0.0 | 1.198819 |  1.204446 |   0.0 |   0.0 | 0.295779 | 0.749734 |
    | 03.01. |  2.4 | 15.7 |  0.091593 |  2.88 | 16.5 | 0.036637 | 0.018319 |  2.861959 |  0.0 | 0.018319 | 0.0 |  8.456833 |  0.0 |  2.861959 |  2.861959 |  0.0 |  0.0 | 0.0 |  2.861959 |  2.468566 | 0.781681 |  0.0 |  0.0 |  0.0 | 1.650589 |   1.21137 |   0.0 |   0.0 |  0.0 |   1.1871 |  0.988629 |   0.0 |   0.0 | 0.292836 | 0.685713 |
    | 03.01. |  0.4 | 16.0 |  0.154861 |  0.48 | 16.8 | 0.061944 | 0.030972 |  0.461681 |  0.0 | 0.030972 | 0.0 |  8.610594 |  0.0 |  0.461681 |  0.461681 |  0.0 |  0.0 | 0.0 |  0.461681 |  2.267868 | 0.769028 |  0.0 |  0.0 |  0.0 | 0.461681 |       0.0 |   0.0 |   0.0 |  0.0 | 1.159771 |  0.818175 |   0.0 |   0.0 | 0.289922 | 0.629963 |
    | 03.01. |  0.2 | 16.7 |  0.470369 |  0.24 | 17.5 | 0.188148 | 0.094074 |  0.209028 |  0.0 | 0.094074 | 0.0 |  8.969368 |  0.0 |  0.209028 |  0.209028 |  0.0 |  0.0 | 0.0 |  0.209028 |  1.792852 | 0.705926 |  0.0 |  0.0 |  0.0 | 0.209028 |       0.0 |   0.0 |   0.0 |  0.0 | 1.009567 |  0.496248 |   0.0 |   0.0 | 0.287037 | 0.498015 |
    | 03.01. |  0.0 | 17.1 |  1.173726 |   0.0 | 17.9 |  0.46949 | 0.234745 |       0.0 |  0.0 | 0.234745 | 0.0 |  9.174382 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  1.430048 | 0.471181 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.844878 |   0.30099 |   0.0 |   0.0 | 0.284181 | 0.397236 |
    | 03.01. |  0.0 | 16.2 |  4.202296 |   0.0 | 17.0 | 1.680918 | 0.840459 |       0.0 |  0.0 | 0.471181 | 0.0 |  8.713101 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   1.15564 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.691727 |  0.182559 |   0.0 |   0.0 | 0.281354 | 0.321011 |
    | 03.01. |  0.3 | 15.9 |  4.359715 |  0.36 | 16.7 | 1.743886 | 0.871943 |       0.0 |  0.0 |     0.36 | 0.0 |   8.55934 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.95562 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.566338 |  0.110728 |   0.0 |   0.0 | 0.278554 |  0.26545 |
    | 03.01. |  2.6 | 16.3 |  5.305753 |  3.12 | 17.1 | 2.122301 | 1.061151 |      2.32 |  0.0 |      0.8 | 0.0 |  8.764354 |  0.0 |      2.32 |      2.32 |  0.0 |  0.0 | 0.0 |      2.32 |  1.113577 |      0.0 |  0.0 |  0.0 |  0.0 | 1.568966 |  0.751034 |   0.0 |   0.0 |  0.0 | 0.610618 |  0.227176 |   0.0 |   0.0 | 0.275782 | 0.309327 |
    | 03.01. |  0.7 | 16.3 |  5.376027 |  0.84 | 17.1 | 2.150411 | 1.075205 |      0.04 |  0.0 |      0.8 | 0.0 |  8.764354 |  0.0 |      0.04 |      0.04 |  0.0 |  0.0 | 0.0 |      0.04 |  1.187464 |      0.0 |  0.0 |  0.0 |  0.0 |     0.04 |       0.0 |   0.0 |   0.0 |  0.0 | 0.641144 |  0.273282 |   0.0 |   0.0 | 0.273038 | 0.329851 |
    | 03.01. |  0.3 | 16.4 |  4.658915 |  0.36 | 17.2 | 1.863566 | 0.931783 |       0.0 |  0.0 |     0.36 | 0.0 |  8.815608 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.964504 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.528429 |  0.165754 |   0.0 |   0.0 | 0.270322 | 0.267918 |
    | 03.01. |  0.3 | 16.5 |  7.789594 |  0.36 | 17.3 | 3.115838 | 1.557919 |       0.0 |  0.0 |     0.36 | 0.0 |  8.866861 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.800807 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.432641 |  0.100535 |   0.0 |   0.0 | 0.267632 | 0.222447 |
    | 03.01. |  0.0 | 18.4 |  4.851567 |   0.0 | 19.2 | 1.940627 | 0.970313 |       0.0 |  0.0 |      0.0 | 0.0 |  9.840678 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.680163 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.354216 |  0.060977 |   0.0 |   0.0 | 0.264969 | 0.188934 |
    | 03.01. |  0.0 | 18.3 |   5.30692 |   0.0 | 19.1 | 2.122768 | 1.061384 |       0.0 |  0.0 |      0.0 | 0.0 |  9.789425 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.589325 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.290008 |  0.036985 |   0.0 |   0.0 | 0.262332 | 0.163701 |
    | 03.01. |  0.0 | 18.1 |  3.286036 |   0.0 | 18.9 | 1.314414 | 0.657207 |       0.0 |  0.0 |      0.0 | 0.0 |  9.686918 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.519593 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.237438 |  0.022432 |   0.0 |   0.0 | 0.259722 | 0.144331 |
    | 03.01. |  0.0 | 16.7 |  1.506216 |   0.0 | 17.5 | 0.602486 | 0.301243 |       0.0 |  0.0 |      0.0 | 0.0 |  8.969368 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.465142 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.194398 |  0.013606 |   0.0 |   0.0 | 0.257138 | 0.129206 |
    | 03.01. |  0.0 | 15.2 |  0.274762 |   0.0 | 16.0 | 0.109905 | 0.054952 |       0.0 |  0.0 |      0.0 | 0.0 |  8.200565 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.421991 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |  0.15916 |  0.008252 |   0.0 |   0.0 | 0.254579 |  0.11722 |
    | 03.01. |  0.0 | 13.4 |  0.087565 |   0.0 | 14.2 | 0.035026 | 0.017513 |       0.0 |  0.0 |      0.0 | 0.0 |  7.278002 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.38736 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.130309 |  0.005005 |   0.0 |   0.0 | 0.252046 |   0.1076 |
    | 03.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.0 |  6.765466 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.359262 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.106688 |  0.003036 |   0.0 |   0.0 | 0.249538 | 0.099795 |
    | 03.01. |  0.0 | 11.6 |  0.084317 |   0.0 | 12.4 | 0.033727 | 0.016863 |       0.0 |  0.0 |      0.0 | 0.0 |  6.355438 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.336245 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.087349 |  0.001841 |   0.0 |   0.0 | 0.247055 | 0.093401 |
    | 03.01. |  0.0 | 11.0 |  0.083215 |   0.0 | 11.8 | 0.033286 | 0.016643 |       0.0 |  0.0 |      0.0 | 0.0 |  6.047917 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.317229 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.071515 |  0.001117 |   0.0 |   0.0 | 0.244597 | 0.088119 |
    | 04.01. |  0.0 | 10.5 |  0.082289 |   0.0 | 11.3 | 0.032916 | 0.016458 |       0.0 |  0.0 |      0.0 | 0.0 |  5.791649 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.301392 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.058552 |  0.000677 |   0.0 |   0.0 | 0.242163 |  0.08372 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.0 |  6.406692 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.288103 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.047938 |  0.000411 |   0.0 |   0.0 | 0.239754 | 0.080028 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.0 |  6.509199 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.276866 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.039248 |  0.000249 |   0.0 |   0.0 | 0.237368 | 0.076907 |
    | 04.01. |  1.3 | 11.2 |  0.083584 |  1.56 | 12.0 | 0.033434 | 0.016717 |      0.76 |  0.0 | 0.016717 | 0.0 |  6.150424 |  0.0 |      0.76 |      0.76 |  0.0 |  0.0 | 0.0 |      0.76 |  0.338468 | 0.783283 |  0.0 |  0.0 |  0.0 |     0.76 |       0.0 |   0.0 |   0.0 |  0.0 | 0.103311 |  0.000151 |   0.0 |   0.0 | 0.235006 | 0.094019 |
    | 04.01. |  0.0 | 11.1 |    0.0834 |   0.0 | 11.9 |  0.03336 |  0.01668 |       0.0 |  0.0 |  0.01668 | 0.0 |   6.09917 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.383931 | 0.766603 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.151171 |  0.000092 |   0.0 |   0.0 | 0.232668 | 0.106647 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 | 0.016973 | 0.0 |  6.509199 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.354177 |  0.74963 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.123769 |  0.000056 |   0.0 |   0.0 | 0.230353 | 0.098383 |
    | 04.01. |  0.0 | 12.2 |  0.310229 |   0.0 | 13.0 | 0.124092 | 0.062046 |       0.0 |  0.0 | 0.062046 | 0.0 |  6.662959 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.329428 | 0.687585 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.101333 |  0.000034 |   0.0 |   0.0 | 0.228061 | 0.091508 |
    | 04.01. |  0.7 | 11.8 |  1.391958 |  0.84 | 12.6 | 0.556783 | 0.278392 |  0.727585 |  0.0 | 0.278392 | 0.0 |  6.457945 |  0.0 |  0.727585 |  0.727585 |  0.0 |  0.0 | 0.0 |  0.727585 |  0.376918 | 0.521608 |  0.0 |  0.0 |  0.0 | 0.727585 |       0.0 |   0.0 |   0.0 |  0.0 | 0.151106 |   0.00002 |   0.0 |   0.0 | 0.225792 | 0.104699 |
    | 04.01. |  0.4 | 11.4 |  3.195876 |  0.48 | 12.2 |  1.27835 | 0.639175 |  0.201608 |  0.0 | 0.639175 | 0.0 |  6.252931 |  0.0 |  0.201608 |  0.201608 |  0.0 |  0.0 | 0.0 |  0.201608 |  0.429901 | 0.160825 |  0.0 |  0.0 |  0.0 | 0.201608 |       0.0 |   0.0 |   0.0 |  0.0 | 0.206344 |  0.000012 |   0.0 |   0.0 | 0.223545 | 0.119417 |
    | 04.01. |  0.1 | 11.6 |  5.191651 |  0.12 | 12.4 |  2.07666 |  1.03833 |       0.0 |  0.0 | 0.280825 | 0.0 |  6.355438 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.407932 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.186604 |  0.000008 |   0.0 |   0.0 | 0.221321 | 0.113315 |
    | 04.01. |  0.4 | 13.0 |  7.155036 |  0.48 | 13.8 | 2.862014 | 1.431007 |       0.0 |  0.0 |     0.48 | 0.0 |  7.072988 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.371901 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.152779 |  0.000005 |   0.0 |   0.0 | 0.219118 | 0.103306 |
    | 04.01. |  0.0 | 17.1 |  8.391432 |   0.0 | 17.9 | 3.356573 | 1.678286 |       0.0 |  0.0 |      0.0 | 0.0 |  9.174382 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.342025 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.125084 |  0.000003 |   0.0 |   0.0 | 0.216938 | 0.095007 |
    | 04.01. |  0.0 | 18.2 |  8.391286 |   0.0 | 19.0 | 3.356514 | 1.678257 |       0.0 |  0.0 |      0.0 | 0.0 |  9.738171 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.317192 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.102411 |  0.000002 |   0.0 |   0.0 |  0.21478 | 0.088109 |
    | 04.01. |  0.0 | 22.4 | 10.715238 |   0.0 | 23.2 | 4.286095 | 2.143048 |       0.0 |  0.0 |      0.0 | 0.0 |  11.89082 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.29649 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.083847 |  0.000001 |   0.0 |   0.0 | 0.212642 | 0.082358 |
    | 04.01. |  0.0 | 21.4 |  9.383394 |   0.0 | 22.2 | 3.753358 | 1.876679 |       0.0 |  0.0 |      0.0 | 0.0 | 11.378284 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.279175 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.068648 |  0.000001 |   0.0 |   0.0 | 0.210527 | 0.077549 |
    | 04.01. |  0.0 | 21.8 |  7.861915 |   0.0 | 22.6 | 3.144766 | 1.572383 |       0.0 |  0.0 |      0.0 | 0.0 | 11.583298 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.264636 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.056204 |       0.0 |   0.0 |   0.0 | 0.208432 |  0.07351 |
    | 04.01. |  0.0 | 22.2 |  6.298329 |   0.0 | 23.0 | 2.519332 | 1.259666 |       0.0 |  0.0 |      0.0 | 0.0 | 11.788313 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.252374 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.046016 |       0.0 |   0.0 |   0.0 | 0.206358 | 0.070104 |
    | 04.01. |  0.0 | 20.1 |  2.948416 |   0.0 | 20.9 | 1.179366 | 0.589683 |       0.0 |  0.0 |      0.0 | 0.0 | 10.711988 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |   0.24198 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.037675 |       0.0 |   0.0 |   0.0 | 0.204305 | 0.067217 |
    | 04.01. |  0.0 | 17.8 |  1.309232 |   0.0 | 18.6 | 0.523693 | 0.261846 |       0.0 |  0.0 |      0.0 | 0.0 |  9.533157 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.233117 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.030845 |       0.0 |   0.0 |   0.0 | 0.202272 | 0.064755 |
    | 04.01. |  0.0 | 15.2 |   0.32955 |   0.0 | 16.0 |  0.13182 |  0.06591 |       0.0 |  0.0 |      0.0 | 0.0 |  8.200565 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.225513 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.025254 |       0.0 |   0.0 |   0.0 | 0.200259 | 0.062643 |
    | 04.01. |  0.0 | 14.5 |  0.089508 |   0.0 | 15.3 | 0.035803 | 0.017902 |       0.0 |  0.0 |      0.0 | 0.0 |  7.841791 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.218943 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.020676 |       0.0 |   0.0 |   0.0 | 0.198267 | 0.060817 |
    | 04.01. |  0.0 | 12.4 |  0.085771 |   0.0 | 13.2 | 0.034308 | 0.017154 |       0.0 |  0.0 |      0.0 | 0.0 |  6.765466 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.213222 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.016928 |       0.0 |   0.0 |   0.0 | 0.196294 | 0.059228 |
    | 04.01. |  0.0 | 11.7 |    0.0845 |   0.0 | 12.5 |   0.0338 |   0.0169 |       0.0 |  0.0 |      0.0 | 0.0 |  6.406692 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |    0.2082 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 |  0.01386 |       0.0 |   0.0 |   0.0 | 0.194341 | 0.057833 |
    | 04.01. |  0.0 | 11.9 |  0.084864 |   0.0 | 12.7 | 0.033946 | 0.016973 |       0.0 |  0.0 |      0.0 | 0.0 |  6.509199 |  0.0 |       0.0 |       0.0 |  0.0 |  0.0 | 0.0 |       0.0 |  0.203754 |      0.0 |  0.0 |  0.0 |  0.0 |      0.0 |       0.0 |   0.0 |   0.0 |  0.0 | 0.011347 |       0.0 |   0.0 |   0.0 | 0.192407 | 0.056598 |

    .. raw:: html

        <iframe
            src="lland_v2_ex4.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>

    :ref:`Recalculation of example 6 <lland_v1_ex6>`

    The following calculation shows, that the outflow values of the
    integration test for snow events are reproduced exactly (note that
    the |PET| values have to be adapted to the changed |TemL| values):

    >>> lnk(ACKER)
    >>> inputs.teml.series = numpy.linspace(-10.0, 10.0, 96)
    >>> inputs.pet.series = (
    ...     0.03733, 0.037872, 0.038415, 0.038955, 0.039492, 0.040028,
    ...     0.110905, 0.71239, 1.641935, 2.661377, 3.014447, 3.343815,
    ...     1.81419, 2.535277, 3.137525, 1.010042, 0.776177, 0.503072,
    ...     0.346957, 0.105225, 0.047837, 0.048345, 0.048848, 0.04935,
    ...     0.04985, 0.05035, 0.050845, 0.051342, 0.051835, 0.052327,
    ...     0.102702, 0.69626, 1.692095, 1.078725, 1.382545, 3.516795,
    ...     1.935692, 5.120597, 2.372527, 1.267695, 1.365632, 1.772603,
    ...     0.997112, 0.185172, 0.0595, 0.059965, 0.060428, 0.06089, 0.06135,
    ...     0.06181, 0.062267, 0.062723, 0.063177, 0.06363, 0.10774,
    ...     0.325317, 0.811522, 2.973865, 3.12363, 3.798742, 3.874722,
    ...     3.373822, 5.667417, 3.434725, 3.787713, 2.368437, 1.120002,
    ...     0.211415, 0.070242, 0.07067, 0.0711, 0.071525, 0.07195, 0.072375,
    ...     0.072795, 0.073217, 0.073637, 0.074055, 0.2705, 1.23095,
    ...     2.866595, 4.66193, 6.271463, 6.833792, 6.738053, 8.078045,
    ...     7.222285, 6.044787, 4.837587, 2.353282, 1.092032, 0.289745,
    ...     0.080167, 0.080565, 0.080962, 0.081357)
    >>> test('lland_v2_ex6')
    |   date | nied |      teml |      pet |  nkor |      tkor |      et0 |     evpo |      nbes |      sbes |      evi |      evb |     wgtf |     schm |     wada |      qdb |     qib1 |     qib2 |      qbb |     qdgz |        q |     inzp |       wats |       waes |       bowa |    qdgz1 |    qdgz2 |    qigz1 |    qigz2 |     qbgz |    qdga1 |    qdga2 |    qiga1 |    qiga2 |     qbga |   outlet |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 01.01. |  0.0 |     -10.0 |  0.03733 |   0.0 |      -9.2 | 0.014932 | 0.007466 |       0.0 |       0.0 |      0.0 | 0.006413 |      0.0 |      0.0 |      0.0 |      0.0 |     0.05 |      0.0 |     0.45 |      0.0 |  0.50098 |      0.0 |        0.0 |        0.0 |  99.493587 |      0.0 |      0.0 |     0.05 |      0.0 |     0.45 |      0.0 |      0.0 | 0.001229 |      0.0 | 0.499751 | 0.139161 |
    | 01.01. |  0.0 | -9.789474 | 0.037872 |   0.0 | -8.989474 | 0.015149 | 0.007574 |       0.0 |       0.0 |      0.0 | 0.006492 |      0.0 |      0.0 |      0.0 |      0.0 | 0.049747 |      0.0 | 0.447468 |      0.0 | 0.502845 |      0.0 |        0.0 |        0.0 |   98.98988 |      0.0 |      0.0 | 0.049747 |      0.0 | 0.447468 |      0.0 |      0.0 | 0.003602 |      0.0 | 0.499243 | 0.139679 |
    | 01.01. |  0.0 | -9.578947 | 0.038415 |   0.0 | -8.778947 | 0.015366 | 0.007683 |       0.0 |       0.0 |      0.0 | 0.006572 |      0.0 |      0.0 |      0.0 |      0.0 | 0.049495 |      0.0 | 0.444949 |      0.0 | 0.504562 |      0.0 |        0.0 |        0.0 |  98.488864 |      0.0 |      0.0 | 0.049495 |      0.0 | 0.444949 |      0.0 |      0.0 | 0.005846 |      0.0 | 0.498715 | 0.140156 |
    | 01.01. |  0.0 | -9.368421 | 0.038955 |   0.0 | -8.568421 | 0.015582 | 0.007791 |       0.0 |       0.0 |      0.0 |  0.00665 |      0.0 |      0.0 |      0.0 |      0.0 | 0.049244 |      0.0 | 0.442444 |      0.0 | 0.506137 |      0.0 |        0.0 |        0.0 |  97.990525 |      0.0 |      0.0 | 0.049244 |      0.0 | 0.442444 |      0.0 |      0.0 | 0.007969 |      0.0 | 0.498168 | 0.140594 |
    | 01.01. |  0.0 | -9.157895 | 0.039492 |   0.0 | -8.357895 | 0.015797 | 0.007898 |       0.0 |       0.0 |      0.0 | 0.006727 |      0.0 |      0.0 |      0.0 |      0.0 | 0.048995 |      0.0 | 0.439953 |      0.0 | 0.507577 |      0.0 |        0.0 |        0.0 |  97.494851 |      0.0 |      0.0 | 0.048995 |      0.0 | 0.439953 |      0.0 |      0.0 | 0.009976 |      0.0 | 0.497601 | 0.140994 |
    | 01.01. |  0.0 | -8.947368 | 0.040028 |   0.0 | -8.147368 | 0.016011 | 0.008006 |       0.0 |       0.0 |      0.0 | 0.006803 |      0.0 |      0.0 |      0.0 |      0.0 | 0.048747 |      0.0 | 0.437474 |      0.0 | 0.508888 |      0.0 |        0.0 |        0.0 |  97.001826 |      0.0 |      0.0 | 0.048747 |      0.0 | 0.437474 |      0.0 |      0.0 | 0.011873 |      0.0 | 0.497015 | 0.141358 |
    | 01.01. |  0.0 | -8.736842 | 0.110905 |   0.0 | -7.936842 | 0.044362 | 0.022181 |       0.0 |       0.0 |      0.0 | 0.018808 |      0.0 |      0.0 |      0.0 |      0.0 | 0.048501 |      0.0 | 0.435009 |      0.0 | 0.510075 |      0.0 |        0.0 |        0.0 |  96.499508 |      0.0 |      0.0 | 0.048501 |      0.0 | 0.435009 |      0.0 |      0.0 | 0.013665 |      0.0 |  0.49641 | 0.141688 |
    | 01.01. |  0.0 | -8.526316 |  0.71239 |   0.0 | -7.726316 | 0.284956 | 0.142478 |       0.0 |       0.0 |      0.0 | 0.120538 |      0.0 |      0.0 |      0.0 |      0.0 |  0.04825 |      0.0 | 0.432498 |      0.0 | 0.511145 |      0.0 |        0.0 |        0.0 |  95.898222 |      0.0 |      0.0 |  0.04825 |      0.0 | 0.432498 |      0.0 |      0.0 | 0.015358 |      0.0 | 0.495787 | 0.141985 |
    | 01.01. |  0.0 | -8.315789 | 1.641935 |   0.0 | -7.515789 | 0.656774 | 0.328387 |       0.0 |       0.0 |      0.0 | 0.277056 |      0.0 |      0.0 |      0.0 |      0.0 | 0.047949 |      0.0 | 0.429491 |      0.0 | 0.512097 |      0.0 |        0.0 |        0.0 |  95.143726 |      0.0 |      0.0 | 0.047949 |      0.0 | 0.429491 |      0.0 |      0.0 | 0.016954 |      0.0 | 0.495142 | 0.142249 |
    | 01.01. |  0.0 | -8.105263 | 2.661377 |   0.0 | -7.305263 | 1.064551 | 0.532275 |       0.0 |       0.0 |      0.0 | 0.447499 |      0.0 |      0.0 |      0.0 |      0.0 | 0.047572 |      0.0 | 0.425719 |      0.0 | 0.512927 |      0.0 |        0.0 |        0.0 |  94.222936 |      0.0 |      0.0 | 0.047572 |      0.0 | 0.425719 |      0.0 |      0.0 | 0.018457 |      0.0 |  0.49447 |  0.14248 |
    | 01.01. |  0.0 | -7.894737 | 3.014447 |   0.0 | -7.094737 | 1.205779 | 0.602889 |       0.0 |       0.0 |      0.0 | 0.504652 |      0.0 |      0.0 |      0.0 |      0.0 | 0.047111 |      0.0 | 0.421115 |      0.0 | 0.513629 |      0.0 |        0.0 |        0.0 |  93.250058 |      0.0 |      0.0 | 0.047111 |      0.0 | 0.421115 |      0.0 |      0.0 | 0.019865 |      0.0 | 0.493763 | 0.142675 |
    | 01.01. |  0.0 | -7.684211 | 3.343815 |   0.0 | -6.884211 | 1.337526 | 0.668763 |       0.0 |       0.0 |      0.0 | 0.557145 |      0.0 |      0.0 |      0.0 |      0.0 | 0.046625 |      0.0 |  0.41625 |      0.0 | 0.514198 |      0.0 |        0.0 |        0.0 |  92.230038 |      0.0 |      0.0 | 0.046625 |      0.0 |  0.41625 |      0.0 |      0.0 | 0.021182 |      0.0 | 0.493016 | 0.142833 |
    | 01.01. |  0.0 | -7.473684 |  1.81419 |   0.0 | -6.673684 | 0.725676 | 0.362838 |       0.0 |       0.0 |      0.0 | 0.300742 |      0.0 |      0.0 |      0.0 |      0.0 | 0.046115 |      0.0 |  0.41115 |      0.0 | 0.514637 |      0.0 |        0.0 |        0.0 |  91.472031 |      0.0 |      0.0 | 0.046115 |      0.0 |  0.41115 |      0.0 |      0.0 | 0.022411 |      0.0 | 0.492227 | 0.142955 |
    | 01.01. |  0.0 | -7.263158 | 2.535277 |   0.0 | -6.463158 | 1.014111 | 0.507055 |       0.0 |       0.0 |      0.0 | 0.418653 |      0.0 |      0.0 |      0.0 |      0.0 | 0.045736 |      0.0 |  0.40736 |      0.0 | 0.514959 |      0.0 |        0.0 |        0.0 |  90.600281 |      0.0 |      0.0 | 0.045736 |      0.0 |  0.40736 |      0.0 |      0.0 | 0.023557 |      0.0 | 0.491401 | 0.143044 |
    | 01.01. |  0.0 | -7.052632 | 3.137525 |   0.0 | -6.252632 |  1.25501 | 0.627505 |       0.0 |       0.0 |      0.0 | 0.515752 |      0.0 |      0.0 |      0.0 |      0.0 |   0.0453 |      0.0 | 0.403001 |      0.0 | 0.515172 |      0.0 |        0.0 |        0.0 |  89.636228 |      0.0 |      0.0 |   0.0453 |      0.0 | 0.403001 |      0.0 |      0.0 | 0.024628 |      0.0 | 0.490543 | 0.143103 |
    | 01.01. |  0.2 | -6.842105 | 1.010042 |  0.24 | -6.042105 | 0.404017 | 0.202008 |       0.0 |       0.0 | 0.202008 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044818 |      0.0 | 0.398181 |      0.0 | 0.515273 | 0.037992 |        0.0 |        0.0 |  89.193229 |      0.0 |      0.0 | 0.044818 |      0.0 | 0.398181 |      0.0 |      0.0 | 0.025625 |      0.0 | 0.489648 | 0.143131 |
    | 01.01. |  0.0 | -6.631579 | 0.776177 |   0.0 | -5.831579 | 0.310471 | 0.155235 |       0.0 |       0.0 | 0.037992 | 0.095638 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044597 |      0.0 | 0.395966 |      0.0 | 0.515282 |      0.0 |        0.0 |        0.0 |  88.657028 |      0.0 |      0.0 | 0.044597 |      0.0 | 0.395966 |      0.0 |      0.0 | 0.026555 |      0.0 | 0.488727 | 0.143134 |
    | 01.01. |  0.0 | -6.421053 | 0.503072 |   0.0 | -5.621053 | 0.201229 | 0.100614 |       0.0 |       0.0 |      0.0 | 0.081831 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044329 |      0.0 | 0.393285 |      0.0 | 0.515219 |      0.0 |        0.0 |        0.0 |  88.137583 |      0.0 |      0.0 | 0.044329 |      0.0 | 0.393285 |      0.0 |      0.0 | 0.027429 |      0.0 | 0.487791 | 0.143116 |
    | 01.01. |  1.3 | -6.210526 | 0.346957 |  1.56 | -5.410526 | 0.138783 | 0.069391 |      0.76 |      0.76 | 0.069391 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.044069 |      0.0 | 0.390688 |      0.0 | 0.515084 | 0.730609 |       0.76 |       0.76 |  87.702827 |      0.0 |      0.0 | 0.044069 |      0.0 | 0.390688 |      0.0 |      0.0 | 0.028246 |      0.0 | 0.486837 | 0.143079 |
    | 01.01. |  5.6 |      -6.0 | 0.105225 |  6.72 |      -5.2 |  0.04209 | 0.021045 |  6.650609 |  6.650609 | 0.021045 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.043851 |      0.0 | 0.388514 |      0.0 | 0.514883 | 0.778955 |   7.410609 |   7.410609 |  87.270461 |      0.0 |      0.0 | 0.043851 |      0.0 | 0.388514 |      0.0 |      0.0 | 0.029013 |      0.0 |  0.48587 | 0.143023 |
    | 01.01. |  2.9 | -5.789474 | 0.047837 |  3.48 | -4.989474 | 0.019135 | 0.009567 |  3.458955 |  3.458955 | 0.009567 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.043635 |      0.0 | 0.386352 |      0.0 | 0.514621 | 0.790433 |  10.869564 |  10.869564 |  86.840473 |      0.0 |      0.0 | 0.043635 |      0.0 | 0.386352 |      0.0 |      0.0 | 0.029731 |      0.0 |  0.48489 |  0.14295 |
    | 01.01. |  4.9 | -5.578947 | 0.048345 |  5.88 | -4.778947 | 0.019338 | 0.009669 |  5.870433 |  5.870433 | 0.009669 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 |  0.04342 |      0.0 | 0.384202 |      0.0 | 0.514303 | 0.790331 |  16.739996 |  16.739996 |  86.412851 |      0.0 |      0.0 |  0.04342 |      0.0 | 0.384202 |      0.0 |      0.0 | 0.030404 |      0.0 | 0.483899 | 0.142862 |
    | 01.01. | 10.6 | -5.368421 | 0.048848 | 12.72 | -4.568421 | 0.019539 |  0.00977 | 12.710331 | 12.710331 |  0.00977 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.043206 |      0.0 | 0.382064 |      0.0 |  0.51393 |  0.79023 |  29.450327 |  29.450327 |   85.98758 |      0.0 |      0.0 | 0.043206 |      0.0 | 0.382064 |      0.0 |      0.0 | 0.031033 |      0.0 | 0.482897 | 0.142758 |
    | 01.01. |  0.1 | -5.157895 |  0.04935 |  0.12 | -4.357895 |  0.01974 |  0.00987 |   0.11023 |   0.11023 |  0.00987 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042994 |      0.0 | 0.379938 |      0.0 | 0.513505 |  0.79013 |  29.560558 |  29.560558 |  85.564648 |      0.0 |      0.0 | 0.042994 |      0.0 | 0.379938 |      0.0 |      0.0 | 0.031622 |      0.0 | 0.481883 |  0.14264 |
    | 02.01. |  0.7 | -4.947368 |  0.04985 |  0.84 | -4.147368 |  0.01994 |  0.00997 |   0.83013 |   0.83013 |  0.00997 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042782 |      0.0 | 0.377823 |      0.0 | 0.513029 |  0.79003 |  30.390688 |  30.390688 |  85.144043 |      0.0 |      0.0 | 0.042782 |      0.0 | 0.377823 |      0.0 |      0.0 | 0.032171 |      0.0 | 0.480858 | 0.142508 |
    | 02.01. |  3.0 | -4.736842 |  0.05035 |   3.6 | -3.936842 |  0.02014 |  0.01007 |   3.59003 |   3.59003 |  0.01007 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042572 |      0.0 |  0.37572 |      0.0 | 0.512506 |  0.78993 |  33.980718 |  33.980718 |  84.725751 |      0.0 |      0.0 | 0.042572 |      0.0 |  0.37572 |      0.0 |      0.0 | 0.032684 |      0.0 | 0.479822 | 0.142363 |
    | 02.01. |  2.1 | -4.526316 | 0.050845 |  2.52 | -3.726316 | 0.020338 | 0.010169 |   2.50993 |   2.50993 | 0.010169 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042363 |      0.0 | 0.373629 |      0.0 | 0.511937 | 0.789831 |  36.490648 |  36.490648 |  84.309759 |      0.0 |      0.0 | 0.042363 |      0.0 | 0.373629 |      0.0 |      0.0 | 0.033161 |      0.0 | 0.478776 | 0.142205 |
    | 02.01. | 10.4 | -4.315789 | 0.051342 | 12.48 | -3.515789 | 0.020537 | 0.010268 | 12.469831 | 12.469831 | 0.010268 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.042155 |      0.0 | 0.371549 |      0.0 | 0.511324 | 0.789732 |  48.960479 |  48.960479 |  83.896055 |      0.0 |      0.0 | 0.042155 |      0.0 | 0.371549 |      0.0 |      0.0 | 0.033604 |      0.0 | 0.477719 | 0.142034 |
    | 02.01. |  3.5 | -4.105263 | 0.051835 |   4.2 | -3.305263 | 0.020734 | 0.010367 |  4.189732 |  4.189732 | 0.010367 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041948 |      0.0 |  0.36948 |      0.0 | 0.510669 | 0.789633 |   53.15021 |   53.15021 |  83.484627 |      0.0 |      0.0 | 0.041948 |      0.0 |  0.36948 |      0.0 |      0.0 | 0.034016 |      0.0 | 0.476652 | 0.141852 |
    | 02.01. |  3.4 | -3.894737 | 0.052327 |  4.08 | -3.094737 | 0.020931 | 0.010465 |  4.069633 |  4.069633 | 0.010465 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041742 |      0.0 | 0.367423 |      0.0 | 0.509974 | 0.789535 |  57.219843 |  57.219843 |  83.075462 |      0.0 |      0.0 | 0.041742 |      0.0 | 0.367423 |      0.0 |      0.0 | 0.034398 |      0.0 | 0.475576 | 0.141659 |
    | 02.01. |  1.2 | -3.684211 | 0.102702 |  1.44 | -2.884211 | 0.041081 |  0.02054 |  1.429535 |  1.429535 |  0.02054 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041538 |      0.0 | 0.365377 |      0.0 | 0.509241 |  0.77946 |  58.649378 |  58.649378 |  82.668547 |      0.0 |      0.0 | 0.041538 |      0.0 | 0.365377 |      0.0 |      0.0 | 0.034751 |      0.0 |  0.47449 | 0.141456 |
    | 02.01. |  0.1 | -3.473684 |  0.69626 |  0.12 | -2.673684 | 0.278504 | 0.139252 |   0.09946 |   0.09946 | 0.139252 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041334 |      0.0 | 0.363343 |      0.0 | 0.508471 | 0.660748 |  58.748837 |  58.748837 |   82.26387 |      0.0 |      0.0 | 0.041334 |      0.0 | 0.363343 |      0.0 |      0.0 | 0.035077 |      0.0 | 0.473394 | 0.141242 |
    | 02.01. |  0.0 | -3.263158 | 1.692095 |   0.0 | -2.463158 | 0.676838 | 0.338419 |       0.0 |       0.0 | 0.338419 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.041132 |      0.0 | 0.361319 |      0.0 | 0.507666 | 0.322329 |  58.748837 |  58.748837 |  81.861418 |      0.0 |      0.0 | 0.041132 |      0.0 | 0.361319 |      0.0 |      0.0 | 0.035377 |      0.0 | 0.472289 | 0.141018 |
    | 02.01. |  0.0 | -3.052632 | 1.078725 |   0.0 | -2.252632 |  0.43149 | 0.215745 |       0.0 |       0.0 | 0.215745 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040931 |      0.0 | 0.359307 |      0.0 | 0.506828 | 0.106584 |  58.748837 |  58.748837 |   81.46118 |      0.0 |      0.0 | 0.040931 |      0.0 | 0.359307 |      0.0 |      0.0 | 0.035653 |      0.0 | 0.471174 | 0.140785 |
    | 02.01. |  0.4 | -2.842105 | 1.382545 |  0.48 | -2.042105 | 0.553018 | 0.276509 |       0.0 |       0.0 | 0.276509 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040731 |      0.0 | 0.357306 |      0.0 | 0.505957 | 0.310075 |  58.748837 |  58.748837 |  81.063144 |      0.0 |      0.0 | 0.040731 |      0.0 | 0.357306 |      0.0 |      0.0 | 0.035906 |      0.0 | 0.470051 | 0.140544 |
    | 02.01. |  0.1 | -2.631579 | 3.516795 |  0.12 | -1.831579 | 1.406718 | 0.703359 |       0.0 |       0.0 | 0.430075 | 0.212168 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040532 |      0.0 | 0.355316 |      0.0 | 0.505056 |      0.0 |  58.748837 |  58.748837 |  80.455129 |      0.0 |      0.0 | 0.040532 |      0.0 | 0.355316 |      0.0 |      0.0 | 0.036136 |      0.0 |  0.46892 | 0.140293 |
    | 02.01. |  3.6 | -2.421053 | 1.935692 |  4.32 | -1.621053 | 0.774277 | 0.387138 |      3.52 |      3.52 | 0.387138 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040228 |      0.0 | 0.352276 |      0.0 | 0.504117 | 0.412862 |  62.268837 |  62.268837 |  80.062626 |      0.0 |      0.0 | 0.040228 |      0.0 | 0.352276 |      0.0 |      0.0 | 0.036343 |      0.0 | 0.467774 | 0.140032 |
    | 02.01. |  5.9 | -2.210526 | 5.120597 |  7.08 | -1.410526 | 2.048239 | 1.024119 |  6.692862 |  6.692862 |      0.8 | 0.172813 |      0.0 |      0.0 |      0.0 |      0.0 | 0.040031 |      0.0 | 0.350313 |      0.0 | 0.503143 |      0.0 |  68.961699 |  68.961699 |  79.499468 |      0.0 |      0.0 | 0.040031 |      0.0 | 0.350313 |      0.0 |      0.0 | 0.036528 |      0.0 | 0.466615 | 0.139762 |
    | 02.01. |  1.1 |      -2.0 | 2.372527 |  1.32 |      -1.2 | 0.949011 | 0.474505 |      0.52 |      0.52 | 0.474505 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 |  0.03975 |      0.0 | 0.347497 |      0.0 | 0.502135 | 0.325495 |  69.481699 |  69.481699 |  79.112221 |      0.0 |      0.0 |  0.03975 |      0.0 | 0.347497 |      0.0 |      0.0 | 0.036692 |      0.0 | 0.465444 | 0.139482 |
    | 02.01. | 20.7 | -1.789474 | 1.267695 | 24.84 | -0.989474 | 0.507078 | 0.253539 | 24.365495 | 24.365495 | 0.253539 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.039556 |      0.0 | 0.345561 |      0.0 | 0.501096 | 0.546461 |  93.847194 |  93.847194 |  78.727104 |      0.0 |      0.0 | 0.039556 |      0.0 | 0.345561 |      0.0 |      0.0 | 0.036836 |      0.0 | 0.464261 | 0.139193 |
    | 02.01. | 37.9 | -1.578947 | 1.365632 | 45.48 | -0.778947 | 0.546253 | 0.273126 | 45.226461 | 45.226461 | 0.273126 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.039364 |      0.0 | 0.343636 |      0.0 | 0.500034 | 0.526874 | 139.073655 | 139.073655 |  78.344105 |      0.0 |      0.0 | 0.039364 |      0.0 | 0.343636 |      0.0 |      0.0 | 0.036964 |      0.0 |  0.46307 | 0.138898 |
    | 02.01. |  8.2 | -1.368421 | 1.772603 |  9.84 | -0.568421 | 0.709041 | 0.354521 |  9.566874 |  9.566874 | 0.354521 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.039172 |      0.0 | 0.341721 |      0.0 | 0.498948 | 0.445479 | 148.640528 | 148.640528 |  77.963212 |      0.0 |      0.0 | 0.039172 |      0.0 | 0.341721 |      0.0 |      0.0 | 0.037076 |      0.0 | 0.461872 | 0.138597 |
    | 02.01. |  3.6 | -1.157895 | 0.997112 |  4.32 | -0.357895 | 0.398845 | 0.199422 |  3.965479 |  3.965479 | 0.199422 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.038982 |      0.0 | 0.339816 |      0.0 | 0.497841 | 0.600578 | 152.606008 | 152.606008 |  77.584415 |      0.0 |      0.0 | 0.038982 |      0.0 | 0.339816 |      0.0 |      0.0 | 0.037174 |      0.0 | 0.460667 | 0.138289 |
    | 02.01. |  7.5 | -0.947368 | 0.185172 |   9.0 | -0.147368 | 0.074069 | 0.037034 |  8.800578 |  8.800578 | 0.037034 |      0.0 |      0.0 |      0.0 |      0.0 |      0.0 | 0.038792 |      0.0 | 0.337922 |      0.0 | 0.496712 | 0.762966 | 161.406585 | 161.406585 |    77.2077 |      0.0 |      0.0 | 0.038792 |      0.0 | 0.337922 |      0.0 |      0.0 | 0.037257 |      0.0 | 0.459455 | 0.137976 |
    | 02.01. | 18.5 | -0.736842 |   0.0595 |  22.2 |  0.063158 |   0.0238 |   0.0119 | 22.162966 | 21.463082 |   0.0119 |      0.0 | 0.032371 | 0.032371 |      0.0 |      0.0 | 0.038604 |      0.0 | 0.336039 |      0.0 | 0.495564 |   0.7881 | 182.837297 | 183.569551 |  76.833058 |      0.0 |      0.0 | 0.038604 |      0.0 | 0.336039 |      0.0 |      0.0 | 0.037327 |      0.0 | 0.458236 | 0.137657 |
    | 02.01. | 15.4 | -0.526316 | 0.059965 | 18.48 |  0.273684 | 0.023986 | 0.011993 |   18.4681 | 15.940886 | 0.011993 |      0.0 | 0.140273 | 0.140273 |      0.0 |      0.0 | 0.038417 |      0.0 | 0.334165 |      0.0 | 0.494396 | 0.788007 | 198.637911 | 202.037651 |  76.460476 |      0.0 |      0.0 | 0.038417 |      0.0 | 0.334165 |      0.0 |      0.0 | 0.037385 |      0.0 | 0.457011 | 0.137332 |
    | 02.01. |  6.3 | -0.315789 | 0.060428 |  7.56 |  0.484211 | 0.024171 | 0.012086 |  7.548007 |  5.720595 | 0.012086 |      0.0 | 0.248175 | 0.248175 |      0.0 |      0.0 |  0.03823 |      0.0 | 0.332302 |      0.0 |  0.49321 | 0.787914 |  204.11033 | 209.585658 |  76.089944 |      0.0 |      0.0 |  0.03823 |      0.0 | 0.332302 |      0.0 |      0.0 | 0.037431 |      0.0 | 0.455779 | 0.137003 |
    | 02.01. |  1.9 | -0.105263 |  0.06089 |  2.28 |  0.694737 | 0.024356 | 0.012178 |  2.267914 |  1.480113 | 0.012178 |      0.0 | 0.356077 | 0.356077 |      0.0 |      0.0 | 0.038045 |      0.0 |  0.33045 |      0.0 | 0.492007 | 0.787822 | 205.234366 | 211.853572 |  75.721449 |      0.0 |      0.0 | 0.038045 |      0.0 |  0.33045 |      0.0 |      0.0 | 0.037465 |      0.0 | 0.454542 | 0.136669 |
    | 03.01. |  4.9 |  0.105263 |  0.06135 |  5.88 |  0.905263 |  0.02454 |  0.01227 |  5.867822 |   3.21186 |  0.01227 |      0.0 | 0.463979 | 0.463979 |      0.0 |      0.0 | 0.037861 |      0.0 | 0.328607 |      0.0 | 0.490787 |  0.78773 | 207.982247 | 217.721394 |  75.354981 |      0.0 |      0.0 | 0.037861 |      0.0 | 0.328607 |      0.0 |      0.0 | 0.037489 |      0.0 | 0.453298 |  0.13633 |
    | 03.01. |  2.7 |  0.315789 |  0.06181 |  3.24 |  1.115789 | 0.024724 | 0.012362 |   3.22773 |  1.426996 | 0.012362 |      0.0 | 0.571882 | 0.571882 |      0.0 |      0.0 | 0.037677 |      0.0 | 0.326775 |      0.0 | 0.489551 | 0.787638 | 208.837362 | 220.949124 |  74.990528 |      0.0 |      0.0 | 0.037677 |      0.0 | 0.326775 |      0.0 |      0.0 | 0.037503 |      0.0 | 0.452048 | 0.135986 |
    | 03.01. |  0.5 |  0.526316 | 0.062267 |   0.6 |  1.326316 | 0.024907 | 0.012453 |  0.587638 |  0.197941 | 0.012453 |      0.0 | 0.679784 | 0.679784 |      0.0 |      0.0 | 0.037495 |      0.0 | 0.324953 |      0.0 | 0.488299 | 0.787547 | 208.355519 | 221.536762 |  74.628081 |      0.0 |      0.0 | 0.037495 |      0.0 | 0.324953 |      0.0 |      0.0 | 0.037507 |      0.0 | 0.450792 | 0.135639 |
    | 03.01. |  0.2 |  0.736842 | 0.062723 |  0.24 |  1.536842 | 0.025089 | 0.012545 |  0.227547 |  0.052695 | 0.012545 |      0.0 | 0.787686 | 0.787686 |      0.0 |      0.0 | 0.037314 |      0.0 |  0.32314 |      0.0 | 0.487033 | 0.787455 | 207.620528 | 221.764309 |  74.267626 |      0.0 |      0.0 | 0.037314 |      0.0 |  0.32314 |      0.0 |      0.0 | 0.037502 |      0.0 | 0.449531 | 0.135287 |
    | 03.01. |  0.5 |  0.947368 | 0.063177 |   0.6 |  1.747368 | 0.025271 | 0.012635 |  0.587455 |  0.074205 | 0.012635 |      0.0 | 0.895588 | 0.895588 |      0.0 |      0.0 | 0.037134 |      0.0 | 0.321338 |      0.0 | 0.485753 | 0.787365 | 206.799145 | 222.351764 |  73.909154 |      0.0 |      0.0 | 0.037134 |      0.0 | 0.321338 |      0.0 |      0.0 | 0.037488 |      0.0 | 0.448265 | 0.134931 |
    | 03.01. |  2.4 |  1.157895 |  0.06363 |  2.88 |  1.957895 | 0.025452 | 0.012726 |  2.867365 |  0.060366 | 0.012726 |      0.0 |  1.00349 |  1.00349 |      0.0 |      0.0 | 0.036955 |      0.0 | 0.319546 |      0.0 | 0.484459 | 0.787274 | 205.856021 | 225.219129 |  73.552654 |      0.0 |      0.0 | 0.036955 |      0.0 | 0.319546 |      0.0 |      0.0 | 0.037466 |      0.0 | 0.446993 | 0.134572 |
    | 03.01. |  0.4 |  1.368421 |  0.10774 |  0.48 |  2.168421 | 0.043096 | 0.021548 |  0.467274 |       0.0 | 0.021548 |      0.0 | 1.111392 | 1.111392 |      0.0 |      0.0 | 0.036776 |      0.0 | 0.317763 |      0.0 | 0.483153 | 0.778452 | 204.744628 | 225.686403 |  73.198114 |      0.0 |      0.0 | 0.036776 |      0.0 | 0.317763 |      0.0 |      0.0 | 0.037437 |      0.0 | 0.445716 | 0.134209 |
    | 03.01. |  0.2 |  1.578947 | 0.325317 |  0.24 |  2.378947 | 0.130127 | 0.065063 |  0.218452 |       0.0 | 0.065063 |      0.0 | 1.219295 | 1.219295 |      0.0 |      0.0 | 0.036599 |      0.0 | 0.315991 |      0.0 | 0.481834 | 0.734937 | 203.525334 | 225.904855 |  72.845525 |      0.0 |      0.0 | 0.036599 |      0.0 | 0.315991 |      0.0 |      0.0 |   0.0374 |      0.0 | 0.444434 | 0.133843 |
    | 03.01. |  0.0 |  1.789474 | 0.811522 |   0.0 |  2.589474 | 0.324609 | 0.162304 |       0.0 |       0.0 | 0.162304 |      0.0 | 1.327197 | 1.327197 |      0.0 |      0.0 | 0.036423 |      0.0 | 0.314228 |      0.0 | 0.480504 | 0.572632 | 202.198137 | 225.904855 |  72.494874 |      0.0 |      0.0 | 0.036423 |      0.0 | 0.314228 |      0.0 |      0.0 | 0.037357 |      0.0 | 0.443147 | 0.133473 |
    | 03.01. |  0.0 |       2.0 | 2.973865 |   0.0 |       2.8 | 1.189546 | 0.594773 |       0.0 |       0.0 | 0.572632 | 0.016112 | 1.435099 | 1.435099 |      0.0 |      0.0 | 0.036247 |      0.0 | 0.312474 |      0.0 | 0.479163 |      0.0 | 200.763038 | 225.904855 |   72.13004 |      0.0 |      0.0 | 0.036247 |      0.0 | 0.312474 |      0.0 |      0.0 | 0.037307 |      0.0 | 0.441855 | 0.133101 |
    | 03.01. |  0.3 |  2.210526 |  3.12363 |  0.36 |  3.010526 | 1.249452 | 0.624726 |       0.0 |       0.0 |     0.36 | 0.192054 | 1.543001 | 1.543001 |      0.0 |      0.0 | 0.036065 |      0.0 |  0.31065 |      0.0 |  0.47781 |      0.0 | 199.220037 | 225.904855 |  71.591271 |      0.0 |      0.0 | 0.036065 |      0.0 |  0.31065 |      0.0 |      0.0 | 0.037251 |      0.0 | 0.440559 | 0.132725 |
    | 03.01. |  2.6 |  2.421053 | 3.798742 |  3.12 |  3.221053 | 1.519497 | 0.759748 |      2.32 |       0.0 | 0.759748 |      0.0 | 1.650903 | 1.650903 |      0.0 |      0.0 | 0.035796 |      0.0 | 0.307956 |      0.0 | 0.476439 | 0.040252 | 197.569134 | 228.224855 |  71.247519 |      0.0 |      0.0 | 0.035796 |      0.0 | 0.307956 |      0.0 |      0.0 | 0.037187 |      0.0 | 0.439253 | 0.132344 |
    | 03.01. |  0.7 |  2.631579 | 3.874722 |  0.84 |  3.431579 | 1.549889 | 0.774944 |  0.080252 |       0.0 | 0.774944 |      0.0 | 1.758805 | 1.758805 |      0.0 |      0.0 | 0.035624 |      0.0 | 0.306238 |      0.0 | 0.475052 | 0.025056 | 195.810328 | 228.305106 |  70.905657 |      0.0 |      0.0 | 0.035624 |      0.0 | 0.306238 |      0.0 |      0.0 | 0.037114 |      0.0 | 0.437938 | 0.131959 |
    | 03.01. |  0.3 |  2.842105 | 3.373822 |  0.36 |  3.642105 | 1.349529 | 0.674764 |       0.0 |       0.0 | 0.385056 | 0.207965 | 1.866708 | 1.866708 |      0.0 |      0.0 | 0.035453 |      0.0 | 0.304528 |      0.0 | 0.473657 |      0.0 |  193.94362 | 228.305106 |  70.357712 |      0.0 |      0.0 | 0.035453 |      0.0 | 0.304528 |      0.0 |      0.0 | 0.037038 |      0.0 | 0.436619 | 0.131571 |
    | 03.01. |  0.3 |  3.052632 | 5.667417 |  0.36 |  3.852632 | 2.266967 | 1.133483 |       0.0 |       0.0 |     0.36 | 0.552551 |  1.97461 |  1.97461 |      0.0 |      0.0 | 0.035179 |      0.0 | 0.301789 |      0.0 | 0.472245 |      0.0 | 191.969011 | 228.305106 |  69.468193 |      0.0 |      0.0 | 0.035179 |      0.0 | 0.301789 |      0.0 |      0.0 | 0.036954 |      0.0 | 0.435291 | 0.131179 |
    | 03.01. |  0.0 |  3.263158 | 3.434725 |   0.0 |  4.063158 |  1.37389 | 0.686945 |       0.0 |       0.0 |      0.0 | 0.486808 | 2.082512 | 2.082512 |      0.0 |      0.0 | 0.034734 |      0.0 | 0.297341 |      0.0 | 0.470797 |      0.0 | 189.886499 | 228.305106 |  68.649311 |      0.0 |      0.0 | 0.034734 |      0.0 | 0.297341 |      0.0 |      0.0 | 0.036856 |      0.0 |  0.43394 | 0.130777 |
    | 03.01. |  0.0 |  3.473684 | 3.787713 |   0.0 |  4.273684 | 1.515085 | 0.757543 |       0.0 |       0.0 |      0.0 | 0.532795 | 2.190414 | 2.190414 |      0.0 |      0.0 | 0.034325 |      0.0 | 0.293247 |      0.0 | 0.469303 |      0.0 | 187.696085 | 228.305106 |  67.788945 |      0.0 |      0.0 | 0.034325 |      0.0 | 0.293247 |      0.0 |      0.0 | 0.036743 |      0.0 | 0.432561 | 0.130362 |
    | 03.01. |  0.0 |  3.684211 | 2.368437 |   0.0 |  4.484211 | 0.947375 | 0.473687 |       0.0 |       0.0 |      0.0 | 0.330459 | 2.298316 | 2.298316 |      0.0 |      0.0 | 0.033894 |      0.0 | 0.288945 |      0.0 | 0.467767 |      0.0 | 185.397768 | 228.305106 |  67.135646 |      0.0 |      0.0 | 0.033894 |      0.0 | 0.288945 |      0.0 |      0.0 | 0.036614 |      0.0 | 0.431153 | 0.129935 |
    | 03.01. |  0.0 |  3.894737 | 1.120002 |   0.0 |  4.694737 | 0.448001 |    0.224 |       0.0 |       0.0 |      0.0 | 0.155289 | 2.406218 | 2.406218 |      0.0 |      0.0 | 0.033568 |      0.0 | 0.285678 |      0.0 | 0.466195 |      0.0 |  182.99155 | 228.305106 |  66.661111 |      0.0 |      0.0 | 0.033568 |      0.0 | 0.285678 |      0.0 |      0.0 | 0.036473 |      0.0 | 0.429722 | 0.129499 |
    | 03.01. |  0.0 |  4.105263 | 0.211415 |   0.0 |  4.905263 | 0.084566 | 0.042283 |       0.0 |       0.0 |      0.0 | 0.029177 | 2.514121 | 2.514121 |      0.0 |      0.0 | 0.033331 |      0.0 | 0.283306 |      0.0 | 0.464603 |      0.0 | 180.477429 | 228.305106 |  66.315298 |      0.0 |      0.0 | 0.033331 |      0.0 | 0.283306 |      0.0 |      0.0 | 0.036326 |      0.0 | 0.428277 | 0.129056 |
    | 03.01. |  0.0 |  4.315789 | 0.070242 |   0.0 |  5.115789 | 0.028097 | 0.014048 |       0.0 |       0.0 |      0.0 | 0.009661 | 2.622023 | 2.622023 |      0.0 |      0.0 | 0.033158 |      0.0 | 0.281576 |      0.0 | 0.463001 |      0.0 | 177.855406 | 228.305106 |  65.990902 |      0.0 |      0.0 | 0.033158 |      0.0 | 0.281576 |      0.0 |      0.0 | 0.036175 |      0.0 | 0.426826 | 0.128611 |
    | 03.01. |  0.0 |  4.526316 |  0.07067 |   0.0 |  5.326316 | 0.028268 | 0.014134 |       0.0 |       0.0 |      0.0 | 0.009688 | 2.729925 | 2.729925 |      0.0 |      0.0 | 0.032995 |      0.0 | 0.279955 |      0.0 | 0.461397 |      0.0 | 175.125481 | 228.305106 |  65.668264 |      0.0 |      0.0 | 0.032995 |      0.0 | 0.279955 |      0.0 |      0.0 | 0.036024 |      0.0 | 0.425372 | 0.128166 |
    | 03.01. |  0.0 |  4.736842 |   0.0711 |   0.0 |  5.536842 |  0.02844 |  0.01422 |       0.0 |       0.0 |      0.0 | 0.009716 | 2.837827 | 2.837827 |      0.0 |      0.0 | 0.032834 |      0.0 | 0.278341 |      0.0 |  0.45979 |      0.0 | 172.287654 | 228.305106 |  65.347373 |      0.0 |      0.0 | 0.032834 |      0.0 | 0.278341 |      0.0 |      0.0 | 0.035873 |      0.0 | 0.423917 | 0.127719 |
    | 03.01. |  0.0 |  4.947368 | 0.071525 |   0.0 |  5.747368 |  0.02861 | 0.014305 |       0.0 |       0.0 |      0.0 | 0.009742 | 2.945729 | 2.945729 |      0.0 |      0.0 | 0.032674 |      0.0 | 0.276737 |      0.0 | 0.458181 |      0.0 | 169.341925 | 228.305106 |   65.02822 |      0.0 |      0.0 | 0.032674 |      0.0 | 0.276737 |      0.0 |      0.0 |  0.03572 |      0.0 | 0.422461 | 0.127273 |
    | 04.01. |  0.0 |  5.157895 |  0.07195 |   0.0 |  5.957895 |  0.02878 |  0.01439 |       0.0 |       0.0 |      0.0 | 0.009768 | 3.053632 | 3.053632 |      0.0 |      0.0 | 0.032514 |      0.0 | 0.275141 |      0.0 | 0.456571 |      0.0 | 166.288293 | 228.305106 |  64.710797 |      0.0 |      0.0 | 0.032514 |      0.0 | 0.275141 |      0.0 |      0.0 | 0.035568 |      0.0 | 0.421003 | 0.126825 |
    | 04.01. |  0.0 |  5.368421 | 0.072375 |   0.0 |  6.168421 |  0.02895 | 0.014475 |       0.0 |       0.0 |      0.0 | 0.009794 | 3.161534 | 3.161534 |      0.0 |      0.0 | 0.032355 |      0.0 | 0.273554 |      0.0 | 0.454959 |      0.0 | 163.126759 | 228.305106 |  64.395094 |      0.0 |      0.0 | 0.032355 |      0.0 | 0.273554 |      0.0 |      0.0 | 0.035415 |      0.0 | 0.419544 | 0.126377 |
    | 04.01. |  0.0 |  5.578947 | 0.072795 |   0.0 |  6.378947 | 0.029118 | 0.014559 |       0.0 |       0.0 |      0.0 | 0.009818 | 3.269436 | 3.269436 | 4.504854 | 0.490564 | 0.032198 |      0.0 | 0.271975 | 0.490564 | 0.499288 |      0.0 | 159.857323 | 223.800253 |  68.095393 | 0.490564 |      0.0 | 0.032198 |      0.0 | 0.271975 | 0.045943 |      0.0 | 0.035262 |      0.0 | 0.418083 | 0.138691 |
    | 04.01. |  1.3 |  5.789474 | 0.073217 |  1.56 |  6.589474 | 0.029287 | 0.014643 |      0.76 |       0.0 | 0.014643 |      0.0 | 3.377338 | 3.377338 | 5.488273 | 0.641231 | 0.034048 |      0.0 | 0.290477 | 0.641231 | 0.592529 | 0.785357 | 156.479985 |  219.07198 |   72.61791 | 0.641231 |      0.0 | 0.034048 |      0.0 | 0.290477 |  0.14065 |      0.0 | 0.035158 |      0.0 | 0.416722 | 0.164592 |
    | 04.01. |  0.0 |       6.0 | 0.073637 |   0.0 |       6.8 | 0.029455 | 0.014727 |       0.0 |       0.0 | 0.014727 |      0.0 |  3.48524 |  3.48524 | 4.879336 | 0.610802 | 0.036309 |      0.0 |  0.31309 | 0.610802 | 0.679278 | 0.770629 | 152.994745 | 214.192643 |  76.537046 | 0.610802 |      0.0 | 0.036309 |      0.0 |  0.31309 |  0.22854 |      0.0 |  0.03516 |      0.0 | 0.415578 | 0.188688 |
    | 04.01. |  0.0 |  6.210526 | 0.074055 |   0.0 |  7.010526 | 0.029622 | 0.014811 |       0.0 |       0.0 | 0.014811 |      0.0 | 3.593142 | 3.593142 | 5.030399 | 0.669984 | 0.038269 |      0.0 | 0.332685 | 0.669984 | 0.753295 | 0.755818 | 149.401603 | 209.162244 |  80.526508 | 0.669984 |      0.0 | 0.038269 |      0.0 | 0.332685 | 0.303375 |      0.0 | 0.035264 |      0.0 | 0.414656 | 0.209249 |
    | 04.01. |  0.0 |  6.421053 |   0.2705 |   0.0 |  7.221053 |   0.1082 |   0.0541 |       0.0 |       0.0 |   0.0541 |      0.0 | 3.701045 | 3.701045 | 5.181462 | 0.733305 | 0.040263 |      0.0 | 0.352633 | 0.733305 | 0.825159 | 0.701718 | 145.700558 | 203.980781 |   84.58177 | 0.733305 |      0.0 | 0.040263 |      0.0 | 0.352633 |  0.37576 |      0.0 | 0.035459 |      0.0 |  0.41394 | 0.229211 |
    | 04.01. |  0.7 |  6.631579 |  1.23095 |  0.84 |  7.431579 |  0.49238 |  0.24619 |  0.741718 |       0.0 |  0.24619 |      0.0 | 3.808947 | 3.808947 | 6.074244 | 0.916515 | 0.042291 |      0.0 | 0.372909 | 0.916515 | 0.906905 |  0.55381 | 141.891611 | 198.648256 |  89.324299 | 0.916515 |      0.0 | 0.042291 |      0.0 | 0.372909 |  0.45773 |      0.0 | 0.035743 |      0.0 | 0.413431 | 0.251918 |
    | 04.01. |  0.4 |  6.842105 | 2.866595 |  0.48 |  7.642105 | 1.146638 | 0.573319 |   0.23381 |       0.0 | 0.573319 |      0.0 | 3.916849 | 3.916849 | 5.717399 | 0.919577 | 0.044662 |      0.0 | 0.396621 | 0.919577 | 0.990448 | 0.226681 | 137.974762 | 193.164667 |  93.680837 | 0.919577 |      0.0 | 0.044662 |      0.0 | 0.396621 | 0.541181 |      0.0 | 0.036121 |      0.0 | 0.413146 | 0.275124 |
    | 04.01. |  0.1 |  7.052632 |  4.66193 |  0.12 |  7.852632 | 1.864772 | 0.932386 |       0.0 |       0.0 | 0.346681 | 0.488981 | 4.024751 | 4.024751 | 5.634652 | 0.960633 |  0.04684 |      0.0 | 0.418404 | 0.960633 | 1.063298 |      0.0 | 133.950011 | 187.530016 |  97.400629 | 0.960633 |      0.0 |  0.04684 |      0.0 | 0.418404 | 0.613617 |      0.0 | 0.036591 |      0.0 |  0.41309 | 0.295361 |
    | 04.01. |  0.4 |  7.263158 | 6.271463 |  0.48 |  8.063158 | 2.508585 | 1.254293 |       0.0 |       0.0 |     0.48 | 0.657717 | 4.132653 | 4.132653 | 5.785715 | 1.036605 |   0.0487 |      0.0 | 0.437003 | 1.036605 | 1.134162 |      0.0 | 129.817358 | 181.744301 | 101.006318 | 1.035313 | 0.001293 |   0.0487 |      0.0 | 0.437003 | 0.683515 | 0.000275 | 0.037137 |      0.0 | 0.413236 | 0.315045 |
    | 04.01. |  0.0 |  7.473684 | 6.833792 |   0.0 |  8.273684 | 2.733517 | 1.366758 |       0.0 |       0.0 |      0.0 | 1.178878 | 4.240555 | 4.240555 | 5.936778 | 1.114955 | 0.050503 | 0.000909 | 0.455032 | 1.114955 |  1.20791 |      0.0 | 125.576803 | 175.807524 |  104.14282 | 1.103103 | 0.011852 | 0.050503 | 0.000909 | 0.455032 | 0.753634 | 0.002925 | 0.037745 | 0.000044 | 0.413562 | 0.335531 |
    | 04.01. |  0.0 |  7.684211 | 6.738053 |   0.0 |  8.484211 | 2.695221 | 1.347611 |       0.0 |       0.0 |      0.0 | 1.176649 | 4.348458 | 4.348458 | 6.087841 | 1.190331 | 0.052071 | 0.007589 | 0.470714 | 1.190331 | 1.285605 |      0.0 | 121.228345 | 169.719683 | 107.333305 | 1.159898 | 0.030433 | 0.052071 | 0.007589 | 0.470714 | 0.822301 | 0.010397 | 0.038406 | 0.000449 | 0.414053 | 0.357113 |
    | 04.01. |  0.0 |  7.894737 | 8.078045 |   0.0 |  8.694737 | 3.231218 | 1.615609 |       0.0 |       0.0 |      0.0 | 1.426926 |  4.45636 |  4.45636 | 6.238904 | 1.270041 | 0.053667 | 0.017873 | 0.486667 | 1.270041 | 1.367898 |      0.0 | 116.771985 | 163.480779 | 110.317036 | 1.212624 | 0.057417 | 0.053667 | 0.017873 | 0.486667 | 0.888435 |  0.02403 | 0.039112 | 0.001626 | 0.414696 | 0.379972 |
    | 04.01. |  0.0 |  8.105263 | 7.222285 |   0.0 |  8.905263 | 2.888914 | 1.444457 |       0.0 |       0.0 |      0.0 | 1.288488 | 4.564262 | 4.564262 | 6.389967 |  1.35009 | 0.055159 | 0.029825 | 0.501585 |  1.35009 | 1.454943 |      0.0 | 112.207723 | 157.090812 | 113.481855 | 1.259309 | 0.090782 | 0.055159 | 0.029825 | 0.501585 | 0.951572 | 0.044275 | 0.039858 | 0.003751 | 0.415486 | 0.404151 |
    | 04.01. |  0.0 |  8.315789 | 6.044787 |   0.0 |  9.115789 | 2.417915 | 1.208957 |       0.0 |       0.0 |      0.0 | 1.088977 | 4.672164 | 4.672164 |  6.54103 | 1.436822 | 0.056741 | 0.044552 | 0.517409 | 1.436822 | 1.547079 |      0.0 | 107.535559 | 150.549783 | 116.878384 |  1.30402 | 0.132803 | 0.056741 | 0.044552 | 0.517409 | 1.011543 | 0.071527 | 0.040643 | 0.006944 | 0.416422 | 0.429744 |
    | 04.01. |  0.0 |  8.526316 | 4.837587 |   0.0 |  9.326316 | 1.935035 | 0.967517 |       0.0 |       0.0 |      0.0 | 0.879931 | 4.780066 | 4.780066 | 6.692093 | 1.531798 | 0.058439 | 0.062408 | 0.534392 | 1.531798 | 1.645648 |      0.0 | 102.755493 |  143.85769 | 120.503509 | 1.347172 | 0.184625 | 0.058439 | 0.062408 | 0.534392 | 1.068601 | 0.106679 |  0.04147 | 0.011387 | 0.417511 | 0.457125 |
    | 04.01. |  0.0 |  8.736842 | 2.353282 |   0.0 |  9.536842 | 0.941313 | 0.470656 |       0.0 |       0.0 |      0.0 | 0.432096 | 4.887969 | 4.887969 | 6.843156 | 1.635847 | 0.060252 | 0.083557 | 0.552518 | 1.635847 | 1.752029 |      0.0 |  97.867524 | 137.014534 | 124.582395 | 1.388696 | 0.247151 | 0.060252 | 0.083557 | 0.552518 | 1.122987 |  0.15067 | 0.042342 | 0.017265 | 0.418765 | 0.486675 |
    | 04.01. |  0.0 |  8.947368 | 1.092032 |   0.0 |  9.747368 | 0.436813 | 0.218406 |       0.0 |       0.0 |      0.0 | 0.202449 | 4.995871 | 4.995871 | 6.994219 |  1.75458 | 0.062291 | 0.109693 | 0.572912 |  1.75458 | 1.868443 |      0.0 |  92.871653 | 130.020315 | 128.874689 | 1.430063 | 0.324517 | 0.062291 | 0.109693 | 0.572912 | 1.175026 | 0.205116 | 0.043266 | 0.024838 | 0.420197 | 0.519012 |
    | 04.01. |  0.0 |  9.157895 | 0.289745 |   0.0 |  9.957895 | 0.115898 | 0.057949 |       0.0 |       0.0 |      0.0 | 0.054207 | 5.103773 | 5.103773 | 7.145282 | 1.884901 | 0.064437 | 0.139643 | 0.594373 | 1.884901 | 1.996846 |      0.0 |  87.767881 | 122.875033 |  133.28241 | 1.469468 | 0.415433 | 0.064437 | 0.139643 | 0.594373 | 1.224947 | 0.271467 | 0.044247 | 0.034362 | 0.421824 | 0.554679 |
    | 04.01. |  0.0 |  9.368421 | 0.080167 |   0.0 | 10.168421 | 0.032067 | 0.016033 |       0.0 |       0.0 |      0.0 | 0.015124 | 5.211675 | 5.211675 | 7.296345 | 2.026056 | 0.066641 | 0.172808 | 0.616412 | 2.026056 | 2.137966 |      0.0 |  82.556206 | 115.578688 | 137.681713 |  1.50643 | 0.519626 | 0.066641 | 0.172808 | 0.616412 | 1.272732 | 0.350313 | 0.045285 | 0.045985 |  0.42365 | 0.593879 |
    | 04.01. |  0.0 |  9.578947 | 0.080565 |   0.0 | 10.378947 | 0.032226 | 0.016113 |       0.0 |       0.0 |      0.0 | 0.015314 | 5.319577 | 5.319577 | 7.447408 | 2.176305 | 0.068841 |  0.20818 | 0.638409 | 2.176305 | 2.291795 |      0.0 |  77.236628 |  108.13128 | 142.022072 | 1.540506 |   0.6358 | 0.068841 |  0.20818 | 0.638409 | 1.318286 | 0.441685 | 0.046381 | 0.059765 | 0.425678 |  0.63661 |
    | 04.01. |  0.0 |  9.789474 | 0.080962 |   0.0 | 10.589474 | 0.032385 | 0.016192 |       0.0 |       0.0 |      0.0 | 0.015492 | 5.427479 | 5.427479 | 7.598471 | 2.335218 | 0.071011 | 0.245165 |  0.66011 | 2.335218 | 2.457865 |      0.0 |  71.809149 | 100.532809 | 146.293547 | 1.571775 | 0.763444 | 0.071011 | 0.245165 |  0.66011 | 1.361496 | 0.545259 |  0.04753 | 0.075678 | 0.427903 |  0.68274 |
    | 04.01. |  0.0 |      10.0 | 0.081357 |   0.0 |      10.8 | 0.032543 | 0.016271 |       0.0 |       0.0 |      0.0 | 0.015659 | 5.535382 | 5.535382 | 7.749534 | 2.503295 | 0.073147 | 0.283481 | 0.681468 | 2.503295 | 2.635806 |      0.0 |  66.273767 |  92.783274 | 150.486032 | 1.600527 | 0.902769 | 0.073147 | 0.283481 | 0.681468 | 1.402306 | 0.660793 | 0.048727 |  0.09366 |  0.43032 | 0.732168 |

    .. raw:: html

        <iframe
            src="lland_v2_ex6.html"
            width="100%"
            height="830px"
            frameborder=0
        ></iframe>
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from lland
from hydpy.models.lland import lland_model
from hydpy.models.lland import lland_control
from hydpy.models.lland import lland_derived
from hydpy.models.lland import lland_inputs
from hydpy.models.lland import lland_fluxes
from hydpy.models.lland import lland_states
from hydpy.models.lland import lland_logs
from hydpy.models.lland import lland_aides
from hydpy.models.lland import lland_outlets
from hydpy.models.lland.lland_constants import *


class Model(modeltools.Model):
    """External ET0 version of HydPy-L-Land (lland_v2)."""
    _RUN_METHODS = (lland_model.calc_nkor_v1,
                    lland_model.calc_tkor_v1,
                    lland_model.calc_et0_wet0_v1,
                    lland_model.calc_evpo_v1,
                    lland_model.calc_nbes_inzp_v1,
                    lland_model.calc_evi_inzp_v1,
                    lland_model.calc_sbes_v1,
                    lland_model.calc_wgtf_v1,
                    lland_model.calc_schm_wats_v1,
                    lland_model.calc_wada_waes_v1,
                    lland_model.calc_evb_v1,
                    lland_model.calc_qbb_v1,
                    lland_model.calc_qib1_v1,
                    lland_model.calc_qib2_v1,
                    lland_model.calc_qdb_v1,
                    lland_model.calc_bowa_v1,
                    lland_model.calc_qbgz_v1,
                    lland_model.calc_qigz1_v1,
                    lland_model.calc_qigz2_v1,
                    lland_model.calc_qdgz_v1,
                    lland_model.calc_qdgz1_qdgz2_v1,
                    lland_model.calc_qbga_v1,
                    lland_model.calc_qiga1_v1,
                    lland_model.calc_qiga2_v1,
                    lland_model.calc_qdga1_v1,
                    lland_model.calc_qdga2_v1,
                    lland_model.calc_q_v1)
    _OUTLET_METHODS = (lland_model.pass_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of lland_v2, directly defined by the user."""
    _PARCLASSES = (lland_control.FT,
                   lland_control.NHRU,
                   lland_control.Lnk,
                   lland_control.FHRU,
                   lland_control.KG,
                   lland_control.KT,
                   lland_control.KE,
                   lland_control.WfET0,
                   lland_control.FLn,
                   lland_control.HInz,
                   lland_control.LAI,
                   lland_control.TRefT,
                   lland_control.TRefN,
                   lland_control.TGr,
                   lland_control.TSp,
                   lland_control.GTF,
                   lland_control.RSchmelz,
                   lland_control.CPWasser,
                   lland_control.PWMax,
                   lland_control.GrasRef_R,
                   lland_control.NFk,
                   lland_control.RelWZ,
                   lland_control.RelWB,
                   lland_control.Beta,
                   lland_control.FBeta,
                   lland_control.DMax,
                   lland_control.DMin,
                   lland_control.BSf,
                   lland_control.A1,
                   lland_control.A2,
                   lland_control.TInd,
                   lland_control.EQB,
                   lland_control.EQI1,
                   lland_control.EQI2,
                   lland_control.EQD1,
                   lland_control.EQD2,
                   lland_control.NegQ)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of lland_v2, indirectly defined by the user."""
    _PARCLASSES = (lland_derived.MOY,
                   lland_derived.KInz,
                   lland_derived.WB,
                   lland_derived.WZ,
                   lland_derived.KB,
                   lland_derived.KI1,
                   lland_derived.KI2,
                   lland_derived.KD1,
                   lland_derived.KD2,
                   lland_derived.QFactor)


class InputSequences(sequencetools.InputSequences):
    """Input sequences of lland_v2."""
    _SEQCLASSES = (lland_inputs.Nied,
                   lland_inputs.TemL,
                   lland_inputs.PET)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of lland_v2."""
    _SEQCLASSES = (lland_fluxes.NKor,
                   lland_fluxes.TKor,
                   lland_fluxes.ET0,
                   lland_fluxes.EvPo,
                   lland_fluxes.NBes,
                   lland_fluxes.SBes,
                   lland_fluxes.EvI,
                   lland_fluxes.EvB,
                   lland_fluxes.WGTF,
                   lland_fluxes.Schm,
                   lland_fluxes.WaDa,
                   lland_fluxes.QDB,
                   lland_fluxes.QIB1,
                   lland_fluxes.QIB2,
                   lland_fluxes.QBB,
                   lland_fluxes.QDGZ,
                   lland_fluxes.Q)


class StateSequences(sequencetools.StateSequences):
    """State sequences of lland_v2."""
    _SEQCLASSES = (lland_states.Inzp,
                   lland_states.WATS,
                   lland_states.WAeS,
                   lland_states.BoWa,
                   lland_states.QDGZ1,
                   lland_states.QDGZ2,
                   lland_states.QIGZ1,
                   lland_states.QIGZ2,
                   lland_states.QBGZ,
                   lland_states.QDGA1,
                   lland_states.QDGA2,
                   lland_states.QIGA1,
                   lland_states.QIGA2,
                   lland_states.QBGA)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of lland_v2."""
    _SEQCLASSES = (lland_logs.WET0,)


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of lland_v2."""
    _SEQCLASSES = (lland_aides.SfA,
                   lland_aides.Exz,
                   lland_aides.BVl,
                   lland_aides.MVl,
                   lland_aides.RVl,
                   lland_aides.EPW)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of lland_v2."""
    _SEQCLASSES = (lland_outlets.Q,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""
.. _Pegasus method: https://link.springer.com/article/10.1007/BF01932959


.. warning::

    Before using |lstream_v1|, read this documentation carefully.
    |lstream_v1| does not keep the water balance.  This flaw is
    under discussion at the moment and should be fixed within the
    next few weeks.

Version 1 of HydPy-L-Stream (called lstream_v1) implements the Williams
routing method in a similar manner as the LARSIM model used by the
German Federal Institute of Hydrology (BfG).  Essentially, routing is
performed via a simple linear storage in each simulation time step.
But the travel time (|RK|) is adapted to the actual flow conditions at
the beginning of each time step, making the approach nonlinear for
instationary inputs.  The storage coefficient is determined via the
Gauckler-Manning-Strickler formula, which is applied on the `triple
trapezoid profile`, shown in the following figure:

.. image:: HydPy-L-Stream_Version-1.png

|RK| depends on the length of the considered channel (|Laen|) and the
mean velocity within the channel. To calculate the velocity based on
the Manning formula, one needs to know the current water stage (|H|).
This water stage is determined by iteration based on the current
reference discharge (|QRef|).  As the relation between |H| and
discharge (|QG|) is discontinuous due to the sharp transitions of the
`triple trapezoid profile`, we decided on an iteration algorithm called
`Pegasus method`_, which is an improved `Regulari Falsi` method that
can be used when the bounds of the search interval are known.  At the
beginning of each simulation interval, we first determine the `highest
section` of the `triple trapozoid profile` containing water (for low flow
conditions, this would be the the main channel).  Then we use its lower
and upper height (in the given example zero and |HM|) as the initial
boundaries and refine them afterwards until the actual water stage |H|
is identified with sufficient accuracy (defined by the tolerance values
|HTol| and |QTol|).  This is much effort for a simple storage routing
method, but due to the superlinear convergence properties of the
`Pegasus method`_ the required computation times seem acceptable.

The above paragraph is a little inaccurate regarding the term `velocity`.
It is well known that a flood wave has usually a considerably higher
velocity than the water itself.  Hence |lstream_v1| should have a
tendency to overestimate travel times.  This is important to note, if
one determines the parameters of |lstream_v1| based on real channel
geometries and roughness coefficients, and should eventually be
compensated through increasing the roughness related calibration
coefficients |EKM| and |EKV|.  However, we took the decision to use
the water velocity, as the same assumption was initially made by the
original LARSIM model.  Later, LARSIM introduced the "dVdQ" option,
allowing to calculate |RK| as the actual wave travel time.  Maybe the
same should also be done for |lstream| through defining an additional
application model.


Integration test:

    The following calculations are performed over a period of 20 hours:

    >>> from hydpy import pub, Timegrid, Timegrids, Nodes, Element
    >>> pub.timegrids = Timegrids(Timegrid('01.01.2000 00:00',
    ...                                    '01.01.2000 20:00',
    ...                                    '1h'))

    Import the model and define the time step size the parameter values
    given below should be related to:

    >>> from hydpy.models.lstream_v1 import *
    >>> parameterstep('1d')

    For testing purposes, the model input shall be retrieved from the nodes
    `input1` and `input2` and the model output shall be passed to node
    `output`.  Firstly, define all nodes:

    >>> nodes = Nodes('input1', 'input2', 'output')

    Secondly, define the element "stream" and build the connections between
    the nodes defined above and the `lstream_v1` model instance:

    >>> stream = Element('stream',
    ...                  inlets=['input1', 'input2'],
    ...                  outlets='output')
    >>> stream.connect(model)

    Prepare a test function object, which sets the initial inflow (|QZ|)
    and outflow (|QA|) to zero before each simulation run:

    >>> from hydpy.core.testtools import IntegrationTest
    >>> IntegrationTest.plotting_options.height = 550
    >>> IntegrationTest.plotting_options.activated=(
    ...     states.qz, states.qa)
    >>> test = IntegrationTest(stream,
    ...                        inits=((states.qz, 0.),
    ...                               (states.qa, 0.)))
    >>> test.dateformat = '%H:%M'

    Define the geometry and roughness values of the test channel:

    >>> bm(2.)
    >>> bnm(4.)
    >>> hm(1.)
    >>> bv(.5, 10.)
    >>> bbv(1., 2.)
    >>> bnv(1., 8.)
    >>> bnvr(20.)
    >>> ekm(1.)
    >>> skm(20.)
    >>> ekv(1.)
    >>> skv(60., 80.)
    >>> gef(.02)
    >>> laen(10.)

    Set the error tolerances of the iteration small enough, to not
    compromise the first six decimal places shown in the following
    results (this increases computation times and should not be
    necessary for usual applications of |lstream_v1|):

    >>> qtol(1e-10)
    >>> htol(1e-10)

    Define two flood events, one for each stream inflow:

    >>> nodes.input1.sequences.sim.series = [
    ...                     0., 0., 1., 3., 2., 1., 0., 0., 0., 0.,
    ...                     0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]
    >>> nodes.input2.sequences.sim.series = [
    ...                     0., 1., 5., 9., 8., 5., 3., 2., 1., 0.,
    ...                     0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]

    The following table and figure show all relevant input and output data
    as well as all relevant variables calculated internally.  Note that the
    total sum of all input values (|QZ|) is 41, but the total sum of all
    output values (|QA|) is above 46.  In our opinion, this is due to
    |lstream_v1| not applying the actual correction after Williams for
    adjusting the flow values to changes in the travel time |RK|.
    We hope to be able to fix this flaw soon...

    >>> test('lstream_v1_ex1')
    |  date |     qref |        h |       am |       av |      avr |       ag |       um |       uv |      uvr |       qm |       qv |      qvr |       qg |       rk |   qz |       qa | input1 | input2 |   output |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | 00:00 |      0.0 |      0.0 |      0.0 | 0.0  0.0 | 0.0  0.0 |      0.0 |      0.0 | 0.0  0.0 | 0.0  0.0 |      0.0 | 0.0  0.0 | 0.0  0.0 |      0.0 |      0.0 |  0.0 |      0.0 |    0.0 |    0.0 |      0.0 |
    | 01:00 | 0.333333 |  0.16889 | 0.451875 | 0.0  0.0 | 0.0  0.0 | 0.451875 | 3.392702 | 0.0  0.0 | 0.0  0.0 | 0.333333 | 0.0  0.0 | 0.0  0.0 | 0.333333 | 3.765627 |  1.0 | 0.121767 |    0.0 |    1.0 | 0.121767 |
    | 02:00 | 2.373922 |  0.47093 | 1.828958 | 0.0  0.0 | 0.0  0.0 | 1.828958 | 5.883386 | 0.0  0.0 | 0.0  0.0 | 2.373922 | 0.0  0.0 | 0.0  0.0 | 2.373922 | 2.140104 |  6.0 | 1.455232 |    1.0 |    5.0 | 1.455232 |
    | 03:00 | 6.485077 | 0.759892 | 3.829526 | 0.0  0.0 | 0.0  0.0 | 3.829526 | 8.266229 | 0.0  0.0 | 0.0  0.0 | 6.485077 | 0.0  0.0 | 0.0  0.0 | 6.485077 | 1.640316 | 12.0 | 5.037344 |    3.0 |    9.0 | 5.037344 |
    | 04:00 | 9.012448 | 0.883278 | 4.887279 | 0.0  0.0 | 0.0  0.0 | 4.887279 | 9.283699 | 0.0  0.0 | 0.0  0.0 | 9.012448 | 0.0  0.0 | 0.0  0.0 | 9.012448 | 1.506336 | 10.0 | 7.876787 |    2.0 |    8.0 | 7.876787 |
    | 05:00 | 7.958929 | 0.834755 | 4.456775 | 0.0  0.0 | 0.0  0.0 | 4.456775 | 8.883568 | 0.0  0.0 | 0.0  0.0 | 7.958929 | 0.0  0.0 | 0.0  0.0 | 7.958929 | 1.555477 |  6.0 | 7.834286 |    1.0 |    5.0 | 7.834286 |
    | 06:00 | 5.611429 | 0.710593 | 3.440959 | 0.0  0.0 | 0.0  0.0 | 3.440959 | 7.859704 | 0.0  0.0 | 0.0  0.0 | 5.611429 | 0.0  0.0 | 0.0  0.0 | 5.611429 | 1.703349 |  3.0 | 6.288891 |    0.0 |    3.0 | 6.288891 |
    | 07:00 | 3.762964 | 0.588614 | 2.563094 | 0.0  0.0 | 0.0  0.0 | 2.563094 | 6.853835 | 0.0  0.0 | 0.0  0.0 | 3.762964 | 0.0  0.0 | 0.0  0.0 | 3.762964 | 1.892047 |  2.0 | 4.715447 |    0.0 |    2.0 | 4.715447 |
    | 08:00 | 2.571816 | 0.489778 | 1.939089 | 0.0  0.0 | 0.0  0.0 | 1.939089 | 6.038817 | 0.0  0.0 | 0.0  0.0 | 2.571816 | 0.0  0.0 | 0.0  0.0 | 2.571816 | 2.094379 |  1.0 |  3.47966 |    0.0 |    1.0 |  3.47966 |
    | 09:00 |  1.49322 | 0.373702 | 1.306015 | 0.0  0.0 | 0.0  0.0 | 1.306015 | 5.081623 | 0.0  0.0 | 0.0  0.0 |  1.49322 | 0.0  0.0 | 0.0  0.0 |  1.49322 | 2.429528 |  0.0 | 2.462745 |    0.0 |    0.0 | 2.462745 |
    | 10:00 | 0.820915 | 0.274466 | 0.850257 | 0.0  0.0 | 0.0  0.0 | 0.850257 | 4.263303 | 0.0  0.0 | 0.0  0.0 | 0.820915 | 0.0  0.0 | 0.0  0.0 | 0.820915 | 2.877065 |  0.0 | 1.739678 |    0.0 |    0.0 | 1.739678 |
    | 11:00 | 0.579893 | 0.228232 | 0.664823 | 0.0  0.0 | 0.0  0.0 | 0.664823 | 3.882048 | 0.0  0.0 | 0.0  0.0 | 0.579893 | 0.0  0.0 | 0.0  0.0 | 0.579893 | 3.184607 |  0.0 | 1.270855 |    0.0 |    0.0 | 1.270855 |
    | 12:00 | 0.423618 | 0.192604 | 0.533594 | 0.0  0.0 | 0.0  0.0 | 0.533594 | 3.588256 | 0.0  0.0 | 0.0  0.0 | 0.423618 | 0.0  0.0 | 0.0  0.0 | 0.423618 |  3.49892 |  0.0 | 0.954934 |    0.0 |    0.0 | 0.954934 |
    | 13:00 | 0.318311 | 0.164646 | 0.437725 | 0.0  0.0 | 0.0  0.0 | 0.437725 | 3.357705 | 0.0  0.0 | 0.0  0.0 | 0.318311 | 0.0  0.0 | 0.0  0.0 | 0.318311 | 3.819853 |  0.0 | 0.734987 |    0.0 |    0.0 | 0.734987 |
    | 14:00 | 0.244996 | 0.142354 | 0.365767 | 0.0  0.0 | 0.0  0.0 | 0.365767 | 3.173881 | 0.0  0.0 | 0.0  0.0 | 0.244996 | 0.0  0.0 | 0.0  0.0 | 0.244996 | 4.147091 |  0.0 | 0.577506 |    0.0 |    0.0 | 0.577506 |
    | 15:00 | 0.192502 | 0.124327 | 0.310483 | 0.0  0.0 | 0.0  0.0 | 0.310483 | 3.025226 | 0.0  0.0 | 0.0  0.0 | 0.192502 | 0.0  0.0 | 0.0  0.0 | 0.192502 | 4.480221 |  0.0 | 0.461977 |    0.0 |    0.0 | 0.461977 |
    | 16:00 | 0.153992 | 0.109562 | 0.267141 | 0.0  0.0 | 0.0  0.0 | 0.267141 | 2.903475 | 0.0  0.0 | 0.0  0.0 | 0.153992 | 0.0  0.0 | 0.0  0.0 | 0.153992 | 4.818789 |  0.0 | 0.375401 |    0.0 |    0.0 | 0.375401 |
    | 17:00 | 0.125134 |  0.09733 | 0.232553 | 0.0  0.0 | 0.0  0.0 | 0.232553 | 2.802606 | 0.0  0.0 | 0.0  0.0 | 0.125134 | 0.0  0.0 | 0.0  0.0 | 0.125134 | 5.162328 |  0.0 | 0.309291 |    0.0 |    0.0 | 0.309291 |
    | 18:00 | 0.103097 |  0.08709 | 0.204518 | 0.0  0.0 | 0.0  0.0 | 0.204518 |  2.71816 | 0.0  0.0 | 0.0  0.0 | 0.103097 | 0.0  0.0 | 0.0  0.0 | 0.103097 | 5.510384 |  0.0 | 0.257961 |    0.0 |    0.0 | 0.257961 |
    | 19:00 | 0.085987 | 0.078434 | 0.181476 | 0.0  0.0 | 0.0  0.0 | 0.181476 | 2.646786 | 0.0  0.0 | 0.0  0.0 | 0.085987 | 0.0  0.0 | 0.0  0.0 | 0.085987 | 5.862528 |  0.0 | 0.217508 |    0.0 |    0.0 | 0.217508 |

    .. raw:: html

        <iframe
            src="lstream_v1_ex1.html"
            width="100%"
            height="580"
            frameborder=0
        ></iframe>

    In the above example, water flows in the main channel only.  At
    least one example needs to be added, in which also the river
    banks are activated.  This could for example be done by reducing
    channel slope:

    >>> gef(.002)


"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from lstream
from hydpy.models.lstream import lstream_model
from hydpy.models.lstream import lstream_control
from hydpy.models.lstream import lstream_derived
from hydpy.models.lstream import lstream_fluxes
from hydpy.models.lstream import lstream_states
from hydpy.models.lstream import lstream_aides
from hydpy.models.lstream import lstream_inlets
from hydpy.models.lstream import lstream_outlets


class Model(modeltools.Model):
    """LARSIM-Stream (Manning) version of HydPy-L-Stream (lstream_v1)."""
    _INLET_METHODS = (lstream_model.pick_q_v1,)
    _RUN_METHODS = (lstream_model.calc_qref_v1,
                    lstream_model.calc_hmin_qmin_hmax_qmax_v1,
                    lstream_model.calc_h_v1,
                    lstream_model.calc_ag_v1,
                    lstream_model.calc_rk_v1,
                    lstream_model.calc_qa_v1)
    _ADD_METHODS = (lstream_model.calc_am_um_v1,
                    lstream_model.calc_qm_v1,
                    lstream_model.calc_av_uv_v1,
                    lstream_model.calc_qv_v1,
                    lstream_model.calc_avr_uvr_v1,
                    lstream_model.calc_qvr_v1,
                    lstream_model.calc_qg_v1)
    _OUTLET_METHODS = (lstream_model.pass_q_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of lstream_v1, directly defined by the user."""
    _PARCLASSES = (lstream_control.Laen,
                   lstream_control.Gef,
                   lstream_control.HM,
                   lstream_control.BM,
                   lstream_control.BV,
                   lstream_control.BBV,
                   lstream_control.BNM,
                   lstream_control.BNV,
                   lstream_control.BNVR,
                   lstream_control.SKM,
                   lstream_control.SKV,
                   lstream_control.EKM,
                   lstream_control.EKV,
                   lstream_control.QTol,
                   lstream_control.HTol)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of lstream_v1, indirectly defined by the user.
    """
    _PARCLASSES = (lstream_derived.HV,
                   lstream_derived.QM,
                   lstream_derived.QV,
                   lstream_derived.Sek)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of LARSIM-ME."""
    _SEQCLASSES = (lstream_fluxes.QRef,
                   lstream_fluxes.H,
                   lstream_fluxes.AM,
                   lstream_fluxes.AV,
                   lstream_fluxes.AVR,
                   lstream_fluxes.AG,
                   lstream_fluxes.UM,
                   lstream_fluxes.UV,
                   lstream_fluxes.UVR,
                   lstream_fluxes.QM,
                   lstream_fluxes.QV,
                   lstream_fluxes.QVR,
                   lstream_fluxes.QG,
                   lstream_fluxes.RK)


class StateSequences(sequencetools.StateSequences):
    """State sequences of lstream_v1."""
    _SEQCLASSES = (lstream_states.QZ,
                   lstream_states.QA)


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of lstream_v1."""
    _SEQCLASSES = (lstream_aides.Temp,
                   lstream_aides.HMin,
                   lstream_aides.HMax,
                   lstream_aides.QMin,
                   lstream_aides.QMax,
                   lstream_aides.QTest)


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of lstream_v1."""
    _SEQCLASSES = (lstream_inlets.Q,)


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of lstream_v1."""
    _SEQCLASSES = (lstream_outlets.Q,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test_v1.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""This simple test model is thought for testing numerical integration
strategies.  It can be seen from two perspectives.  On the one hand
it implements the Dahlquist test equation (on the real axis only), which is
related to stiff initial value problems.  On the other hand it describes a
simple storage with a linear loss term and without any input.  The loss rate
|Q| and the initial storage content |S| can be set as required.
"""
# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from test
from hydpy.models.test import test_model
from hydpy.models.test import test_control
from hydpy.models.test import test_solver
from hydpy.models.test import test_fluxes
from hydpy.models.test import test_states


class Model(modeltools.ModelELS):
    """Test model, Version 1."""
    _PART_ODE_METHODS = (test_model.calc_q_v1,)
    _FULL_ODE_METHODS = (test_model.calc_s_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of Test model, Version 1."""
    _PARCLASSES = (test_control.K,)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of the Test model,."""
    _PARCLASSES = (test_solver.AbsErrorMax,
                   test_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of Test model, Version 1."""
    _SEQCLASSES = (test_fluxes.Q,)


class StateSequences(sequencetools.StateSequences):
    """State sequences of Test model, Version 1."""
    _SEQCLASSES = (test_states.S,)

autodoc_applicationmodel()


# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test_v2.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long, wildcard-import, unused-wildcard-import
"""This simple test model is thought for testing numerical integration
strategies.  It can be seen from two perspectives.  On the one hand
it implements a simple discontinous equation, bringing numerical integration
algorithms into trouble.  On the other hand it describes a simple storage
with a loss that is constant over time, as long as some storage content is
left.  The loss rate |Q| and the initial storage content |S| can be set as
required.
"""
# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core.modelimports import *
from hydpy.core import modeltools
from hydpy.core import parametertools
from hydpy.core import sequencetools
# ...from test
from hydpy.models.test import test_model
from hydpy.models.test import test_control
from hydpy.models.test import test_solver
from hydpy.models.test import test_fluxes
from hydpy.models.test import test_states


class Model(modeltools.ModelELS):
    """Test model, Version 2."""
    _PART_ODE_METHODS = (test_model.calc_q_v2,)
    _FULL_ODE_METHODS = (test_model.calc_s_v1,)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of Test model, Version 2."""
    _PARCLASSES = (test_control.K,)


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of the Test model,."""
    _PARCLASSES = (test_solver.AbsErrorMax,
                   test_solver.RelDTMin)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of Test model, Version 2."""
    _SEQCLASSES = (test_fluxes.Q,)


class StateSequences(sequencetools.StateSequences):
    """State sequences of Test model, Version 2."""
    _SEQCLASSES = (test_states.S,)


autodoc_applicationmodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# pylint: disable=wildcard-import
"""
The HydPy-A base model provides features to implement flood routing models
based on autoregressive (AR) and moving-average (MA) methods.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from arma
from hydpy.models.arma.arma_control import ControlParameters
from hydpy.models.arma.arma_derived import DerivedParameters
from hydpy.models.arma.arma_fluxes import FluxSequences
from hydpy.models.arma.arma_logs import LogSequences
from hydpy.models.arma.arma_inlets import InletSequences
from hydpy.models.arma.arma_outlets import OutletSequences
from hydpy.models.arma.arma_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import parametertools
from hydpy.core import objecttools


class Responses(parametertools.Parameter):
    """Assigns different ARMA models to different discharge thresholds.

    Parameter |Responses| is not involved in the actual calculations
    during the simulation run.  Instead, it is thought for the intuitive
    handling of different ARMA models.  It can be applied as follows.

    Initially, each new `responses` object is emtpy:

    >>> from hydpy.models.arma import *
    >>> parameterstep()
    >>> responses
    responses()

    One can assign ARMA models as attributes to it:

    >>> responses.th_0_0 = ((1, 2), (3, 4, 6))

    `th_0_0` stands for a threshold discharge value of 0.0 m³/s, which the
    given ARMA model corresponds to.  For integer discharge values, one can
    omit the decimal digit:

    >>> responses.th_1 = ((), (7,))

    One can also omit the leading letters, but not the underscore:

    >>> responses.th_2_5 = ([8], range(9, 20))

    Internally, all threshold keys are brought into the standard format:

    >>> responses
    responses(th_0_0=((1.0, 2.0),
                      (3.0, 4.0, 6.0)),
              th_1_0=((),
                      (7.0,)),
              th_2_5=((8.0,),
                      (9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0,
                       18.0, 19.0)))

    All ARMA models are available via attribute access and their attribute
    names are made available to function |dir|:

    >>> 'th_1_0' in dir(responses)
    True

    Note that all iterables containing the AR and MA coefficients are
    converted to tuples, to prevent them from being changed by accident:

    >>> responses.th_1[1][0]
    7.0
    >>> responses.th_1_0[1][0] = 77
    Traceback (most recent call last):
    ...
    TypeError: 'tuple' object does not support item assignment

    Instead, one can delete and or overwrite existing ARMA models:

    >>> del responses.th_2_5
    >>> responses.th_1 = ((), (77,))
    >>> responses
    responses(th_0_0=((1.0, 2.0),
                      (3.0, 4.0, 6.0)),
              th_1_0=((),
                      (77.0,)))

    Names that cannot be identified as threshold values result in an exception:

    >>> responses.test = ((), ())
    Traceback (most recent call last):
    ...
    AttributeError: To define different response functions for parameter `responses` of element `?`, one has to pass them as keyword arguments or set them as additional attributes.  The used name must meet a specific format (see the documentation for further information).  The given name `test` does not meet this format.

    Suitable get-related attribute exceptions are also implemented:

    >>> responses.test
    Traceback (most recent call last):
    ...
    AttributeError: Parameter `responses` of element `?` does not have an attribute named `test` and the name `test` is also not a valid threshold value identifier.

    >>> responses._0_1
    Traceback (most recent call last):
    ...
    AttributeError: Parameter `responses` of element `?` does not have an attribute attribute named `_0_1` nor an arma model corresponding to a threshold value named `th_0_1`.

    The above examples show that all AR and MA coefficients are converted to
    floating point values.  It this is not possible or something else goes
    totally wrong during the definition of a new ARMA model, errors like the
    following are raised:

    >>> responses.th_10 = ()
    Traceback (most recent call last):
    ...
    IndexError: While trying to set a new threshold (th_10) coefficient pair for parameter `responses` of element `?`, the following error occured: tuple index out of range

    Except for the mentioned conversion to floating point values, there are
    no plausibility checks performed.  You have to use other tools to gain
    plausible coefficients.  The HydPy framework offers the module
    |iuhtools| for such purposes.

    Prepare one instantaneous unit hydrograph (iuh) based on the
    Translation Diffusion Equation and another one based on the Linear
    Storage Cascade:

    >>> from hydpy.auxs.iuhtools import TranslationDiffusionEquation
    >>> tde = TranslationDiffusionEquation(d=5., u=2., x=4.)
    >>> from hydpy.auxs.iuhtools import LinearStorageCascade
    >>> lsc = LinearStorageCascade(n=2.5, k=1.)

    The following line deletes the coefficients defined above and assigns the
    ARMA approximations of both iuh models:

    >>> responses(lsc, _2=tde)

    One can change the parameter values of the translation diffusion iuh and
    assign it to the `responses` parameter, without affecting the ARMA
    coefficients of the first tde parametrization:

    >>> tde.u = 1.
    >>> responses._5 = tde
    >>> responses
    responses(th_0_0=((1.001744, -0.32693, 0.034286),
                      (0.050456, 0.199156, 0.04631, -0.004812, -0.00021)),
              th_2_0=((2.028483, -1.447371, 0.420257, -0.039595, -0.000275),
                      (0.165732, 0.061819, -0.377523, 0.215754, -0.024597,
                       -0.002684)),
              th_5_0=((3.032315, -3.506645, 1.908546, -0.479333, 0.042839,
                       0.00009),
                      (0.119252, -0.054959, -0.342744, 0.433585, -0.169102,
                       0.014189, 0.001967)))

    One may have noted the Linear Storage Cascade model was passed as
    a positional argument and was assigned to a treshold value of 0.0 m³/s
    automatically, which is the default value.  As each treshold value has to
    be unique, one can pass only one positional argument:

    >>> responses(tde, lsc)
    Traceback (most recent call last):
    ...
    ValueError: For parameter `responses` of element `?` at most one positional argument is allowed, but `2` are given.

    Checks for the repeated definition of the same threshold values are also
    performed:

    >>> responses(tde, _0=lsc, _1=tde, _1_0=lsc)
    Traceback (most recent call last):
    ...
    ValueError: For parameter `responses` of element `?` `4` arguments have been given but only `2` response functions could be prepared.  Most probably, you defined the same threshold value(s) twice.

    The number of response functions and the number of the respective AR and
    MA coefficients of a given `responses` parameter can be easily queried:

    >>> responses(_0=((1.0, 2.0),
    ...               (3.0, 4.0, 6.0)),
    ...           _1=((),
    ...               (7.0,)))
    >>> len(responses)
    2
    >>> responses.ar_orders
    (2, 0)
    >>> responses.ma_orders
    (3, 1)

    The threshold values and AR coefficients and the MA coefficients can all
    be queried as numpy arrays:

    >>> responses.thresholds
    array([ 0.,  1.])
    >>> responses.ar_coefs
    array([[  1.,   2.],
           [ nan,  nan]])
    >>> responses.ma_coefs
    array([[  3.,   4.,   6.],
           [  7.,  nan,  nan]])

    Technical notes:

    The implementation of this class is much to tricky for subpackage `models`.
    It should be generalized and moved to the framework core later.

    Furthermore, it would be nice to avoid the `nan` values in the coefficent
    representations.  But this would possibly require to define a specialized
    `arrays in list` type in Cython.
    """
    NDIM, TYPE, TIME, SPAN = 0, float, None, (None, None)

    def __init__(self, *args, **kwargs):
        with objecttools.ResetAttrFuncs(self):
            self.subpars = None
            self.fastaccess = None
            self._coefs = {}
        parametertools.Parameter.__init__(self, *args, **kwargs)

    def connect(self, subpars):
        self.__dict__['subpars'] = subpars

    def __call__(self, *args, **kwargs):
        self._coefs.clear()
        if len(args) > 1:
            raise ValueError(
                'For parameter `%s` of element `%s` at most one positional '
                'argument is allowed, but `%d` are given.'
                % (self.name, objecttools.devicename(self.subpars), len(args)))
        for (key, value) in kwargs.items():
            setattr(self, key, value)
        if len(args) == 1:
            setattr(self, 'th_0_0', args[0])
        if len(args)+len(kwargs) != len(self):
            raise ValueError(
                'For parameter `%s` of element `%s` `%d` arguments have been '
                'given but only `%s` response functions could be prepared.  '
                'Most probably, you defined the same threshold value(s) twice.'
                % (self.name, objecttools.devicename(self.subpars),
                   len(args)+len(kwargs), len(self)))

    def _has_predefined_attr(self, name):
        return ((name in self.__dict__ or
                 name in Responses.__dict__ or
                 name in parametertools.Parameter.__dict__) and
                not name.startswith('th_'))

    def __getattribute__(self, key):
        try:
            return object.__getattribute__(self, key)
        except AttributeError:
            pass
        try:
            std_key = self._standardize_key(key)
        except AttributeError:
            raise AttributeError(
                'Parameter `%s` of element `%s` does not have an attribute '
                'named `%s` and the name `%s` is also not a valid threshold '
                'value identifier.'
                % (self.name, objecttools.devicename(self.subpars), key, key))
        if std_key in self._coefs:
            return self._coefs[std_key]
        else:
            raise AttributeError(
                'Parameter `%s` of element `%s` does not have an attribute '
                'attribute named `%s` nor an arma model corresponding to a '
                'threshold value named `%s`.'
                % (self.name, objecttools.devicename(self.subpars),
                   key, std_key))

    def __setattr__(self, key, value):
        if self._has_predefined_attr(key):
            object.__setattr__(self, key, value)
        else:
            std_key = self._standardize_key(key)
            try:
                try:
                    self._coefs[std_key] = value.arma.coefs
                except AttributeError:
                    self._coefs[std_key] = (tuple(float(v) for v in value[0]),
                                            tuple(float(v) for v in value[1]))
            except BaseException:
                objecttools.augment_excmessage(
                    'While trying to set a new threshold (%s) coefficient '
                    'pair for parameter `%s` of element `%s`'
                    % (key, self.name, objecttools.devicename(self.subpars)))

    def __delattr__(self, key):
        std_key = self._standardize_key(key)
        if std_key in self._coefs:
            del self._coefs[std_key]

    def _standardize_key(self, key):
        try:
            tuple_ = str(key).split('_')
            if (len(tuple_) > 1) and tuple_[-2].isdigit():
                integer = int(tuple_[-2])
                decimal = int(tuple_[-1])
            else:
                integer = int(tuple_[-1])
                decimal = 0
            return '_'.join(('th', str(integer), str(decimal)))
        except BaseException:
            raise AttributeError(
                'To define different response functions for parameter `%s` of '
                'element `%s`, one has to pass them as keyword arguments or '
                'set them as additional attributes.  The used name must meet '
                'a specific format (see the documentation for further '
                'information).  The given name `%s` does not meet this format.'
                % (self.name, objecttools.devicename(self.subpars), key))

    @property
    def thresholds(self):
        """Threshold values of the response functions."""
        return numpy.array(sorted(self._key2float(key)
                                  for key in self._coefs.keys()), dtype=float)

    @staticmethod
    def _key2float(key):
        return float(key[3:].replace('_', '.'))

    def _getorders(self, index):
        orders = []
        for _, coefs in self:
            orders.append(len(coefs[index]))
        return tuple(orders)

    @property
    def ar_orders(self):
        """Number of AR coefficients of the different response functions."""
        return self._getorders(0)

    @property
    def ma_orders(self):
        """Number of MA coefficients of the different response functions."""
        return self._getorders(1)

    def _getcoefs(self, index):
        orders = self._getorders(index)
        max_orders = max(orders) if len(orders) else 0
        coefs = numpy.full((len(self), max_orders), numpy.nan)
        for idx, (order, (_, coef)) in enumerate(zip(orders, self)):
            coefs[idx, :order] = coef[index]
        return coefs

    @property
    def ar_coefs(self):
        """AR coefficients of the different response functions.

        The first row contains the AR coefficients related to the the smallest
        threshold value, the last row contains the AR coefficients related to
        the highest threshold value.  The number of columns depend on the
        highest number of AR coefficients among all response functions."""
        return self._getcoefs(0)

    @property
    def ma_coefs(self):
        """AR coefficients of the different response functions.

        The first row contains the MA coefficients related to the the smallest
        threshold value, the last row contains the AR coefficients related to
        the highest threshold value.  The number of columns depend on the
        highest number of MA coefficients among all response functions."""
        return self._getcoefs(1)

    def __len__(self):
        return len(self._coefs)

    def __iter__(self):
        for key in sorted(self._coefs.keys(),  key=self._key2float):
            yield key, self._coefs[key]

    def __repr__(self):
        strings = self.commentrepr()
        prefix = '%s(' % self.name
        blanks = ' '*len(prefix)
        if len(self):
            for idx, (th, coefs) in enumerate(self):
                subprefix = ('%s%s=' % (prefix, th) if idx == 0 else
                             '%s%s=' % (blanks, th))
                strings.append(objecttools.assignrepr_tuple2(coefs, subprefix,
                                                             75) + ',')
            strings[-1] = strings[-1][:-1] + ')'
        else:
            strings.append(prefix + ')')
        return '\n'.join(strings)

    def __dir__(self):
        attrs = objecttools.dir_(self)
        attrs.extend(self._coefs.keys())
        return attrs


class ControlParameters(parametertools.SubParameters):
    """Control parameters of arma, directly defined by the user."""
    _PARCLASSES = (Responses,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import parametertools


class Nmb(parametertools.SingleParameter):
    """Number of response functions [-].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.nmb.update()
    >>> derived.nmb
    nmb(2)

    Note that updating parameter `nmb` sets the shape of the flux
    sequences |QPIn|, |QPOut|, |QMA|, and |QAR| automatically.

    >>> fluxes.qpin
    qpin(nan, nan)
    >>> fluxes.qpout
    qpout(nan, nan)
    >>> fluxes.qma
    qma(nan, nan)
    >>> fluxes.qar
    qar(nan, nan)
    """
    NDIM, TYPE, TIME, SPAN = 0, int, None, (0, None)

    def update(self):
        pars = self.subpars.pars
        responses = pars.control.responses
        fluxes = pars.model.sequences.fluxes
        self(len(responses))
        fluxes.qpin.shape = self.value
        fluxes.qpout.shape = self.value
        fluxes.qma.shape = self.value
        fluxes.qar.shape = self.value


class MaxQ(parametertools.MultiParameter):
    """Maximum discharge values of the respective ARMA models [m³/s].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.maxq.update()
    >>> derived.maxq
    maxq(0.0, 3.0)
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0, None)

    def update(self):
        responses = self.subpars.pars.control.responses
        self.shape = len(responses)
        self(responses.thresholds)


class DiffQ(parametertools.MultiParameter):
    """Differences between the values of |MaxQ| [m³/s].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.diffq.update()
    >>> derived.diffq
    diffq(3.0)
     >>> responses(((1., 2.), (1.,)))
    >>> derived.diffq.update()
    >>> derived.diffq
    diffq()
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0, None)

    def update(self):
        responses = self.subpars.pars.control.responses
        self.shape = len(responses)-1
        self(numpy.diff(responses.thresholds))


class AR_Order(parametertools.MultiParameter):
    """Number of AR coefficients of the different responses [-].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.ar_order.update()
    >>> derived.ar_order
    ar_order(2, 1)
    """
    NDIM, TYPE, TIME, SPAN = 1, int, None, (0, None)

    def update(self):
        responses = self.subpars.pars.control.responses
        self.shape = len(responses)
        self(responses.ar_orders)


class MA_Order(parametertools.MultiParameter):
    """Number of MA coefficients of the different responses [-].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.ma_order.update()
    >>> derived.ma_order
    ma_order(1, 3)
    """
    NDIM, TYPE, TIME, SPAN = 1, int, None, (0, None)

    def update(self):
        responses = self.subpars.pars.control.responses
        self.shape = len(responses)
        self(responses.ma_orders)


class AR_Coefs(parametertools.MultiParameter):
    """AR coefficients of the different responses [-].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.ar_coefs.update()
    >>> derived.ar_coefs
    ar_coefs([[1.0, 2.0],
              [1.0, nan]])

    Note that updating parameter `ar_coefs` sets the shape of the log
    sequence |LogOut| automatically.

    >>> logs.logout
    logout([[nan, nan],
            [nan, nan]])
    """
    NDIM, TYPE, TIME, SPAN = 2, float, None, (None, None)

    def update(self):
        pars = self.subpars.pars
        coefs = pars.control.responses.ar_coefs
        self.shape = coefs.shape
        self(coefs)
        pars.model.sequences.logs.logout.shape = self.shape


class MA_Coefs(parametertools.MultiParameter):
    """MA coefficients of the different responses [-].

    Example:

    >>> from hydpy.models.arma import *
    >>> parameterstep('1d')
    >>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
    >>> derived.ma_coefs.update()
    >>> derived.ma_coefs
    ma_coefs([[1.0, nan, nan],
              [1.0, 2.0, 3.0]])

    Note that updating parameter `ar_coefs` sets the shape of the log
    sequence |LogIn| automatically.

    >>> logs.login
    login([[nan, nan, nan],
           [nan, nan, nan]])
    """
    NDIM, TYPE, TIME, SPAN = 2, float, None, (None, None)

    def update(self):
        pars = self.subpars.pars
        coefs = pars.control.responses.ma_coefs
        self.shape = coefs.shape
        self(coefs)
        pars.model.sequences.logs.login.shape = self.shape


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of arma, indirectly defined by the user."""
    _PARCLASSES = (Nmb,
                   MaxQ,
                   DiffQ,
                   AR_Order,
                   MA_Order,
                   AR_Coefs,
                   MA_Coefs)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class QIn(sequencetools.FluxSequence):
    """Total inflow [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QPIn(sequencetools.FluxSequence):
    """Inflow portions corresponding to the different thresholds [m³/s]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class QMA(sequencetools.FluxSequence):
    """MA result for the different thresholds [m³/s]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class QAR(sequencetools.FluxSequence):
    """AR result for the different thresholds [m³/s]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class QPOut(sequencetools.FluxSequence):
    """Outflow portions corresponding to the different thresholds [m³/s]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class QOut(sequencetools.FluxSequence):
    """Total outflow [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of the ARMA model."""
    _SEQCLASSES = (QIn,
                   QPIn,
                   QMA,
                   QAR,
                   QPOut,
                   QOut)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_inlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Runoff [m³/s]."""
    NDIM, NUMERIC = 1, False


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of the ARMA model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_logs.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class LogIn(sequencetools.LogSequence):
    """The recent and the past inflow portions for the application of the
    different MA processes [m³/s]."""
    NDIM, NUMERIC, SPAN = 2, False, (None, None)


class LogOut(sequencetools.LogSequence):
    """The past outflow portions for the application of the
    different AR processes [m³/s]."""
    NDIM, NUMERIC, SPAN = 2, False, (None, None)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of the ARMA model."""
    _SEQCLASSES = (LogIn,
                   LogOut)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
# -*- coding: utf-8 -*-

# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools


def calc_qpin_v1(self):
    """Calculate the input discharge portions of the different response
    functions.

    Required derived parameters:
      |Nmb|
      |MaxQ|
      |DiffQ|

    Required flux sequence:
      |QIn|

    Calculated flux sequences:
      |QPIn|

    Examples:

        Initialize an arma model with three different response functions:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb = 3
        >>> derived.maxq.shape = 3
        >>> derived.diffq.shape = 2
        >>> fluxes.qpin.shape = 3

        Define the maximum discharge value of the respective response
        functions and their successive differences:

        >>> derived.maxq(0.0, 2.0, 6.0)
        >>> derived.diffq(2., 4.)

        The first six examples are performed for inflow values ranging from
        0 to 12 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(
        ...     model, model.calc_qpin_v1,
        ...     last_example=6,
        ...     parseqs=(fluxes.qin, fluxes.qpin))
        >>> test.nexts.qin = 0., 1., 2., 4., 6., 12.
        >>> test()
        | ex. |  qin |           qpin |
        -------------------------------
        |   1 |  0.0 | 0.0  0.0   0.0 |
        |   2 |  1.0 | 1.0  0.0   0.0 |
        |   3 |  2.0 | 2.0  0.0   0.0 |
        |   4 |  4.0 | 2.0  2.0   0.0 |
        |   5 |  6.0 | 2.0  4.0   0.0 |
        |   6 | 12.0 | 2.0  4.0   6.0 |


        The following two additional examples are just supposed to
        demonstrate method |calc_qpin_v1| also functions properly if
        there is only one response function, wherefore total discharge
        does not need to be divided:

        >>> derived.nmb = 1
        >>> derived.maxq.shape = 1
        >>> derived.diffq.shape = 0
        >>> fluxes.qpin.shape = 1
        >>> derived.maxq(0.)

        >>> test = UnitTest(
        ...     model, model.calc_qpin_v1,
        ...     first_example=7, last_example=8,
        ...                 parseqs=(fluxes.qin,
        ...                          fluxes.qpin))
        >>> test.nexts.qin = 0., 12.
        >>> test()
        | ex. |  qin | qpin |
        ---------------------
        |   7 |  0.0 |  0.0 |
        |   8 | 12.0 | 12.0 |

    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for idx in range(der.nmb-1):
        if flu.qin < der.maxq[idx]:
            flu.qpin[idx] = 0.
        elif flu.qin < der.maxq[idx+1]:
            flu.qpin[idx] = flu.qin-der.maxq[idx]
        else:
            flu.qpin[idx] = der.diffq[idx]
    flu.qpin[der.nmb-1] = max(flu.qin-der.maxq[der.nmb-1], 0.)


def calc_login_v1(self):
    """Refresh the input log sequence for the different MA processes.

    Required derived parameters:
      |Nmb|
      |MA_Order|

    Required flux sequence:
      |QPIn|

    Updated log sequence:
      |LogIn|

    Example:

        Assume there are three response functions, involving one, two and
        three MA coefficients respectively:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb(3)
        >>> derived.ma_order.shape = 3
        >>> derived.ma_order = 1, 2, 3
        >>> fluxes.qpin.shape = 3
        >>> logs.login.shape = (3, 3)

        The "memory values" of the different MA processes are defined as
        follows (one row for each process):

        >>> logs.login = ((1.0, nan, nan),
        ...               (2.0, 3.0, nan),
        ...               (4.0, 5.0, 6.0))

        These are the new inflow discharge portions to be included into
        the memories of the different processes:

        >>> fluxes.qpin = 7.0, 8.0, 9.0

        Through applying method |calc_login_v1| all values already
        existing are shifted to the right ("into the past").  Values,
        which are no longer required due to the limited order or the
        different MA processes, are discarded.  The new values are
        inserted in the first column:

        >>> model.calc_login_v1()
        >>> logs.login
        login([[7.0, nan, nan],
               [8.0, 2.0, nan],
               [9.0, 4.0, 5.0]])
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for idx in range(der.nmb):
        for jdx in range(der.ma_order[idx]-2, -1, -1):
            log.login[idx, jdx+1] = log.login[idx, jdx]
    for idx in range(der.nmb):
        log.login[idx, 0] = flu.qpin[idx]


def calc_qma_v1(self):
    """Calculate the discharge responses of the different MA processes.

    Required derived parameters:
      |Nmb|
      |MA_Order|
      |MA_Coefs|

    Required log sequence:
      |LogIn|

    Calculated flux sequence:
      |QMA|

    Examples:

        Assume there are three response functions, involving one, two and
        three MA coefficients respectively:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb(3)
        >>> derived.ma_order.shape = 3
        >>> derived.ma_order = 1, 2, 3
        >>> derived.ma_coefs.shape = (3, 3)
        >>> logs.login.shape = (3, 3)
        >>> fluxes.qma.shape = 3

        The coefficients of the different MA processes are stored in
        separate rows of the 2-dimensional parameter `ma_coefs`:

        >>> derived.ma_coefs = ((1.0, nan, nan),
        ...                     (0.8, 0.2, nan),
        ...                     (0.5, 0.3, 0.2))

        The "memory values" of the different MA processes are defined as
        follows (one row for each process).  The current values are stored
        in first column, the values of the last time step in the second
        column, and so on:

        >>> logs.login = ((1.0, nan, nan),
        ...               (2.0, 3.0, nan),
        ...               (4.0, 5.0, 6.0))

        Applying method |calc_qma_v1| is equivalent to calculating the
        inner product of the different rows of both matrices:

        >>> model.calc_qma_v1()
        >>> fluxes.qma
        qma(1.0, 2.2, 4.7)

    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for idx in range(der.nmb):
        flu.qma[idx] = 0.
        for jdx in range(der.ma_order[idx]):
            flu.qma[idx] += der.ma_coefs[idx, jdx] * log.login[idx, jdx]


def calc_qar_v1(self):
    """Calculate the discharge responses of the different AR processes.

    Required derived parameters:
      |Nmb|
      |AR_Order|
      |AR_Coefs|

    Required log sequence:
      |LogOut|

    Calculated flux sequence:
      |QAR|

    Examples:

        Assume there are four response functions, involving zero, one, two,
        and three AR coefficients respectively:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb(4)
        >>> derived.ar_order.shape = 4
        >>> derived.ar_order = 0, 1, 2, 3
        >>> derived.ar_coefs.shape = (4, 3)
        >>> logs.logout.shape = (4, 3)
        >>> fluxes.qar.shape = 4

        The coefficients of the different AR processes are stored in
        separate rows of the 2-dimensional parameter `ma_coefs`.
        Note the special case of the first AR process of zero order
        (first row), which involves no autoregressive memory at all:

        >>> derived.ar_coefs = ((nan, nan, nan),
        ...                     (1.0, nan, nan),
        ...                     (0.8, 0.2, nan),
        ...                     (0.5, 0.3, 0.2))

        The "memory values" of the different AR processes are defined as
        follows (one row for each process).  The values of the last time
        step are stored in first column, the values of the last time step
        in the second column, and so on:

        >>> logs.logout = ((nan, nan, nan),
        ...                (1.0, nan, nan),
        ...                (2.0, 3.0, nan),
        ...                (4.0, 5.0, 6.0))

        Applying method |calc_qar_v1| is equivalent to calculating the
        inner product of the different rows of both matrices:

        >>> model.calc_qar_v1()
        >>> fluxes.qar
        qar(0.0, 1.0, 2.2, 4.7)

    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for idx in range(der.nmb):
        flu.qar[idx] = 0.
        for jdx in range(der.ar_order[idx]):
            flu.qar[idx] += der.ar_coefs[idx, jdx] * log.logout[idx, jdx]


def calc_qpout_v1(self):
    """Calculate the ARMA results for the different response functions.

    Required derived parameter:
      |Nmb|

    Required flux sequences:
      |QMA|
      |QAR|

    Calculated flux sequence:
      |QPOut|

    Examples:

        Initialize an arma model with three different response functions:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb(3)
        >>> fluxes.qma.shape = 3
        >>> fluxes.qar.shape = 3
        >>> fluxes.qpout.shape = 3

        Define the output values of the MA and of the AR processes
        associated with the three response functions and apply
        method |calc_qpout_v1|:

        >>> fluxes.qar = 4.0, 5.0, 6.0
        >>> fluxes.qma = 1.0, 2.0, 3.0
        >>> model.calc_qpout_v1()
        >>> fluxes.qpout
        qpout(5.0, 7.0, 9.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for idx in range(der.nmb):
        flu.qpout[idx] = flu.qma[idx]+flu.qar[idx]


def calc_logout_v1(self):
    """Refresh the log sequence for the different AR processes.

    Required derived parameters:
      |Nmb|
      |AR_Order|

    Required flux sequence:
      |QPOut|

    Updated log sequence:
      |LogOut|

    Example:

        Assume there are four response functions, involving zero, one, two
        and three AR coefficients respectively:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb(4)
        >>> derived.ar_order.shape = 4
        >>> derived.ar_order = 0, 1, 2, 3
        >>> fluxes.qpout.shape = 4
        >>> logs.logout.shape = (4, 3)

        The "memory values" of the different AR processes are defined as
        follows (one row for each process).  Note the special case of the
        first AR process of zero order (first row), which is why there are
        no autoregressive memory values required:

        >>> logs.logout = ((nan, nan, nan),
        ...                (0.0, nan, nan),
        ...                (1.0, 2.0, nan),
        ...                (3.0, 4.0, 5.0))

        These are the new outflow discharge portions to be included into
        the memories of the different processes:

        >>> fluxes.qpout = 6.0, 7.0, 8.0, 9.0

        Through applying method |calc_logout_v1| all values already
        existing are shifted to the right ("into the past").  Values, which
        are no longer required due to the limited order or the different
        AR processes, are discarded.  The new values are inserted in the
        first column:

        >>> model.calc_logout_v1()
        >>> logs.logout
        logout([[nan, nan, nan],
                [7.0, nan, nan],
                [8.0, 1.0, nan],
                [9.0, 3.0, 4.0]])

    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for idx in range(der.nmb):
        for jdx in range(der.ar_order[idx]-2, -1, -1):
            log.logout[idx, jdx+1] = log.logout[idx, jdx]
    for idx in range(der.nmb):
        if der.ar_order[idx] > 0:
            log.logout[idx, 0] = flu.qpout[idx]


def calc_qout_v1(self):
    """Sum up the results of the different response functions.

    Required derived parameter:
      |Nmb|

    Required flux sequences:
      |QPOut|

    Calculated flux sequence:
      |QOut|

    Examples:

        Initialize an arma model with three different response functions:

        >>> from hydpy.models.arma import *
        >>> parameterstep()
        >>> derived.nmb(3)
        >>> fluxes.qpout.shape = 3

        Define the output values of the three response functions and
        apply method |calc_qout_v1|:

        >>> fluxes.qpout = 1.0, 2.0, 3.0
        >>> model.calc_qout_v1()
        >>> fluxes.qout
        qout(6.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.qout = 0.
    for idx in range(der.nmb):
        flu.qout += flu.qpout[idx]


def pick_q_v1(self):
    """Update inflow."""
    flu = self.sequences.fluxes.fastaccess
    inl = self.sequences.inlets.fastaccess
    flu.qin = 0.
    for idx in range(inl.len_q):
        flu.qin += inl.q[idx][0]


def pass_q_v1(self):
    """Update outflow."""
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += flu.qout


class Model(modeltools.Model):
    """Base model ARMA."""

    _INLET_METHODS = (pick_q_v1,)
    _RUN_METHODS = (calc_qpin_v1,
                    calc_login_v1,
                    calc_qma_v1,
                    calc_qar_v1,
                    calc_qpout_v1,
                    calc_logout_v1,
                    calc_qout_v1)
    _OUTLET_METHODS = (pass_q_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/arma/arma_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Runoff [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of the ARMA model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
# -*- coding: utf-8 -*-
# pylint: disable=wildcard-import
"""
The HydPy-D base model provides features to implement water barriers like
dams, weirs, lakes, or polders.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
from hydpy.auxs.anntools import ann
# ...from dam
from hydpy.models.dam.dam_control import ControlParameters
from hydpy.models.dam.dam_derived import DerivedParameters
from hydpy.models.dam.dam_solver import SolverParameters
from hydpy.models.dam.dam_fluxes import FluxSequences
from hydpy.models.dam.dam_states import StateSequences
from hydpy.models.dam.dam_logs import LogSequences
from hydpy.models.dam.dam_aides import AideSequences
from hydpy.models.dam.dam_inlets import InletSequences
from hydpy.models.dam.dam_outlets import OutletSequences
from hydpy.models.dam.dam_receivers import ReceiverSequences
from hydpy.models.dam.dam_senders import SenderSequences
from hydpy.models.dam.dam_model import Model

autodoc_basemodel()

# pylint: disable=invalid-name
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_aides.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class WaterLevel(sequencetools.AideSequence):
    """Water level [m]."""
    NDIM, NUMERIC, SPAN = 0, True, (None, None)


class AideSequences(sequencetools.AideSequences):
    """State sequences of the dam model."""
    _SEQCLASSES = (WaterLevel,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools
from hydpy.auxs import anntools


class CatchmentArea(parametertools.SingleParameter):
    """Size of the catchment draining into the dam [km2]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class NmbLogEntries(parametertools.SingleParameter):
    """Number of log entries for certain variables [m3/s].

    Note that setting a new value by calling the parameter object sets
    the shapes of all associated log sequences automatically, except those
    with a predefined default shape:

    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> nmblogentries(3)
    >>> for seq in logs:
    ...     print(seq)
    loggedtotalremotedischarge(nan, nan, nan)
    loggedoutflow(nan, nan, nan)
    loggedrequiredremoterelease(nan)
    loggedallowedremoterelieve(nan)
    """
    NDIM, TYPE, TIME, SPAN = 0, int, None, (1, None)

    def __call__(self, *args, **kwargs):
        parametertools.SingleParameter.__call__(self, *args, **kwargs)
        for seq in self.subpars.pars.model.sequences.logs:
            try:
                seq.shape = self
            except AttributeError:
                pass


class RemoteDischargeMinimum(parametertools.SeasonalParameter):
    """Discharge threshold of a cross section far downstream that
    should not be undercut by the actual discharge [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def __call__(self, *args, **kwargs):
        self.shape = (None, )
        parametertools.SeasonalParameter.__call__(self, *args, **kwargs)


class RemoteDischargeSafety(parametertools.SeasonalParameter):
    """Safety factor to reduce the risk to release not enough water [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class WaterLevel2PossibleRemoteRelieve(anntools.ANN):
    """Artificial neural network describing the relationship between
    water level and the highest possible water release used to relieve
    the dam during high flow conditions [-]."""


class RemoteRelieveTolerance(parametertools.SingleParameter):
    """A tolerance value for the "possible remote relieve" [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class NearDischargeMinimumThreshold(parametertools.SeasonalParameter):
    """Discharge threshold of a cross section in the near of the dam that
    not be undercut by the actual discharge [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def __call__(self, *args, **kwargs):
        self.shape = (None, )
        parametertools.SeasonalParameter.__call__(self, *args, **kwargs)


class NearDischargeMinimumTolerance(parametertools.SeasonalParameter):
    """A tolerance value for the "near discharge minimum" [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class RestrictTargetedRelease(parametertools.SingleParameter):
    """A flag indicating whether low flow variability has to be preserved
    or not [-]."""
    NDIM, TYPE, TIME, SPAN = 0, bool, None, (None, None)


class WaterLevelMinimumThreshold(parametertools.SingleParameter):
    """The minimum operating water level of the dam [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0, None)


class WaterLevelMinimumTolerance(parametertools.SingleParameter):
    """A tolarance value for the minimum operating water level [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0, None)


class WaterLevelMinimumRemoteThreshold(parametertools.SingleParameter):
    """The minimum operating water level of the dam regarding remote
    water supply [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0, None)


class WaterLevelMinimumRemoteTolerance(parametertools.SingleParameter):
    """A tolarance value for the minimum operating water level regarding
    remote water supply [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0, None)


class HighestRemoteRelieve(parametertools.SeasonalParameter):
    """The highest possible relieve discharge from another location [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class WaterLevelRelieveThreshold(parametertools.SeasonalParameter):
    """The threshold water level of the dam regarding the allowed
    relieve discharge from another location [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class WaterLevelRelieveTolerance(parametertools.SeasonalParameter):
    """A tolerance value for parameter |WaterLevelRelieveThreshold| [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class HighestRemoteSupply(parametertools.SeasonalParameter):
    """The highest possible supply discharge from another location [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class WaterLevelSupplyThreshold(parametertools.SeasonalParameter):
    """The threshold water level of the dam regarding the requried
    supply discharge from another location [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class WaterLevelSupplyTolerance(parametertools.SeasonalParameter):
    """A tolerance value for parameter |WaterLevelSupplyThreshold| [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class HighestRemoteDischarge(parametertools.SingleParameter):
    """The highest possible discharge between two remote locations [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0.0, None)


class HighestRemoteTolerance(parametertools.SingleParameter):
    """Smoothing parameter associated with |HighestRemoteDischarge| [m3/s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0.0, None)


class WaterVolume2WaterLevel(anntools.ANN):
    """Artificial neural network describing the relationship between
    water level and water volume [-]."""


class WaterLevel2FloodDischarge(anntools.SeasonalANN):
    """Artificial neural network describing the relationship between
    flood discharge and water volume [-]."""


class ControlParameters(parametertools.SubParameters):
    """Control parameters of the dam model, directly defined by the user."""
    _PARCLASSES = (CatchmentArea,
                   NmbLogEntries,
                   RemoteDischargeMinimum,
                   RemoteDischargeSafety,
                   WaterLevel2PossibleRemoteRelieve,
                   RemoteRelieveTolerance,
                   NearDischargeMinimumThreshold,
                   NearDischargeMinimumTolerance,
                   RestrictTargetedRelease,
                   WaterLevelMinimumThreshold,
                   WaterLevelMinimumTolerance,
                   WaterLevelMinimumRemoteThreshold,
                   WaterLevelMinimumRemoteTolerance,
                   HighestRemoteRelieve,
                   WaterLevelRelieveThreshold,
                   WaterLevelRelieveTolerance,
                   HighestRemoteSupply,
                   WaterLevelSupplyThreshold,
                   WaterLevelSupplyTolerance,
                   HighestRemoteDischarge,
                   HighestRemoteTolerance,
                   WaterVolume2WaterLevel,
                   WaterLevel2FloodDischarge)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy import pub
from hydpy.core import parametertools
from hydpy.auxs import smoothtools


class TOY(parametertools.IndexParameter):
    """References the "global" time of the year index array [-]."""
    NDIM, TYPE, TIME, SPAN = 1, int, None, (0, None)

    def update(self):
        self.setreference(pub.indexer.timeofyear)


class Seconds(parametertools.SingleParameter):
    """Length of the actual simulation step size in seconds [s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        self.value = self.simulationstep.seconds


class RemoteDischargeSmoothPar(parametertools.MultiParameter):
    """Smoothing parameter to be derived from |RemoteDischargeSafety| [m3/s].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2000.01.03',
    ...                                    '1d'))
    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> remotedischargesafety(0.0)
    >>> remotedischargesafety.values[1] = 2.5
    >>> derived.remotedischargesmoothpar.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic1
    >>> from hydpy import round_
    >>> round_(smooth_logistic1(0.1, derived.remotedischargesmoothpar[0]))
    1.0
    >>> round_(smooth_logistic1(2.5, derived.remotedischargesmoothpar[1]))
    0.99
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.remotedischargesafety
        self.shape = metapar.shape
        for idx, metapar in enumerate(metapar.values):
            self.values[idx] = smoothtools.calc_smoothpar_logistic1(metapar)


class NearDischargeMinimumSmoothPar1(parametertools.MultiParameter):
    """Smoothing parameter to be derived from |NearDischargeMinimumThreshold|
    for smoothing kernel |smooth_logistic1| [m3/s].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2000.01.03',
    ...                                    '1d'))
    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> neardischargeminimumtolerance(0.0)
    >>> neardischargeminimumtolerance.values[1] = 2.5
    >>> derived.neardischargeminimumsmoothpar1.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic1
    >>> from hydpy import round_
    >>> round_(smooth_logistic1(
    ...     1.0, derived.neardischargeminimumsmoothpar1[0]))
    1.0
    >>> round_(smooth_logistic1(
    ...     2.5, derived.neardischargeminimumsmoothpar1[1]))
    0.99
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.neardischargeminimumtolerance
        self.shape = metapar.shape
        for idx, metapar in enumerate(metapar.values):
            self.values[idx] = smoothtools.calc_smoothpar_logistic1(metapar)


class NearDischargeMinimumSmoothPar2(parametertools.MultiParameter):
    """Smoothing parameter to be derived from |NearDischargeMinimumThreshold|
    for smoothing kernel |smooth_logistic2| [m3/s].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2000.01.03',
    ...                                    '1d'))
    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> neardischargeminimumtolerance(0.0)
    >>> neardischargeminimumtolerance.values[1] = 2.5
    >>> derived.neardischargeminimumsmoothpar2.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic2
    >>> from hydpy import round_
    >>> round_(smooth_logistic2(
    ...     0.0, derived.neardischargeminimumsmoothpar2[0]))
    0.0
    >>> round_(smooth_logistic2(
    ...     2.5, derived.neardischargeminimumsmoothpar2[1]))
    2.51
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.neardischargeminimumtolerance
        self.shape = metapar.shape
        for idx, metapar in enumerate(metapar.values):
            self.values[idx] = smoothtools.calc_smoothpar_logistic2(metapar)


class WaterLevelMinimumSmoothPar(parametertools.SingleParameter):
    """Smoothing parameter to be derived from
    |WaterLevelMinimumTolerance| for smoothing kernel |smooth_logistic1| [m].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> waterlevelminimumtolerance(0.0)
    >>> derived.waterlevelminimumsmoothpar.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic1
    >>> from hydpy import round_
    >>> round_(smooth_logistic1(0.1, derived.waterlevelminimumsmoothpar))
    1.0
    >>> waterlevelminimumtolerance(2.5)
    >>> derived.waterlevelminimumsmoothpar.update()
    >>> round_(smooth_logistic1(2.5, derived.waterlevelminimumsmoothpar))
    0.99
    """
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.waterlevelminimumtolerance
        self.value = smoothtools.calc_smoothpar_logistic1(metapar)


class WaterLevelMinimumRemoteSmoothPar(parametertools.SingleParameter):
    """Smoothing parameter to be derived from
    |WaterLevelMinimumRemoteTolerance| [m].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> waterlevelminimumremotetolerance(0.0)
    >>> derived.waterlevelminimumremotesmoothpar.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic1
    >>> from hydpy import round_
    >>> round_(smooth_logistic1(0.1, derived.waterlevelminimumremotesmoothpar))
    1.0
    >>> waterlevelminimumremotetolerance(2.5)
    >>> derived.waterlevelminimumremotesmoothpar.update()
    >>> round_(smooth_logistic1(2.5, derived.waterlevelminimumremotesmoothpar))
    0.99
    """
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.waterlevelminimumremotetolerance
        self.value = smoothtools.calc_smoothpar_logistic1(metapar)


class WaterLevelRelieveSmoothPar(parametertools.MultiParameter):
    """Smoothing parameter to be derived from |WaterLevelRelieveTolerance|
    for smoothing kernel |smooth_logistic1| [m3/s].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2000.01.03',
    ...                                    '1d'))
    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> waterlevelrelievetolerance(0.0)
    >>> waterlevelrelievetolerance.values[1] = 2.5
    >>> derived.waterlevelrelievesmoothpar.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic1
    >>> from hydpy import round_
    >>> round_(smooth_logistic1(
    ...     1.0, derived.waterlevelrelievesmoothpar[0]))
    1.0
    >>> round_(smooth_logistic1(
    ...     2.5, derived.waterlevelrelievesmoothpar[1]))
    0.99
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.waterlevelrelievetolerance
        self.shape = metapar.shape
        for idx, metapar in enumerate(metapar.values):
            self.values[idx] = smoothtools.calc_smoothpar_logistic1(metapar)


class WaterLevelSupplySmoothPar(parametertools.MultiParameter):
    """Smoothing parameter to be derived from |WaterLevelSupplyTolerance|
    for smoothing kernel |smooth_logistic1| [m3/s].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy import pub
    >>> from hydpy import Timegrids, Timegrid
    >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
    ...                                    '2000.01.03',
    ...                                    '1d'))
    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> waterlevelsupplytolerance(0.0)
    >>> waterlevelsupplytolerance.values[1] = 2.5
    >>> derived.waterlevelsupplysmoothpar.update()
    >>> from hydpy.cythons.smoothutils import smooth_logistic1
    >>> from hydpy import round_
    >>> round_(smooth_logistic1(
    ...     1.0, derived.waterlevelsupplysmoothpar[0]))
    1.0
    >>> round_(smooth_logistic1(
    ...     2.5, derived.waterlevelsupplysmoothpar[1]))
    0.99
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        metapar = self.subpars.pars.control.waterlevelsupplytolerance
        self.shape = metapar.shape
        for idx, metapar in enumerate(metapar.values):
            self.values[idx] = smoothtools.calc_smoothpar_logistic1(metapar)


class HighestRemoteSmoothPar(parametertools.SingleParameter):
    """Smoothing parameter to be derived from |HighestRemoteTolerance|
    for smoothing kernel |smooth_min1| [m3/s].

    The following example is explained in some detail in module
    |smoothtools|:

    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> highestremotedischarge(1.0)
    >>> highestremotetolerance(0.0)
    >>> derived.highestremotesmoothpar.update()
    >>> from hydpy.cythons.smoothutils import smooth_min1
    >>> from hydpy import round_
    >>> round_(smooth_min1(-4.0, 1.5, derived.highestremotesmoothpar))
    -4.0
    >>> highestremotetolerance(2.5)
    >>> derived.highestremotesmoothpar.update()
    >>> round_(smooth_min1(-4.0, -1.5, derived.highestremotesmoothpar))
    -4.01

    Note that the example above corresponds to the example on function
    |calc_smoothpar_min1|, due to the value of parameter
    |HighestRemoteDischarge| being 1 m³/s.  Doubling the value of
    |HighestRemoteDischarge| also doubles the value of
    |HighestRemoteSmoothPar| proportional.  This leads to the following
    result:

    >>> highestremotedischarge(2.0)
    >>> derived.highestremotesmoothpar.update()
    >>> round_(smooth_min1(-4.0, 1.0, derived.highestremotesmoothpar))
    -4.02

    This relationship between |HighestRemoteDischarge| and
    |HighestRemoteSmoothPar| prevents from any smoothing when
    the value of |HighestRemoteDischarge| is zero:

    >>> highestremotedischarge(0.0)
    >>> derived.highestremotesmoothpar.update()
    >>> round_(smooth_min1(1.0, 1.0, derived.highestremotesmoothpar))
    1.0

    In addition, |HighestRemoteSmoothPar| is set to zero if
    |HighestRemoteDischarge| is infinity (because no actual value
    will ever come in the vicinit of infinity), which is why no
    value would be changed through smoothing anyway):

    >>> highestremotedischarge(inf)
    >>> derived.highestremotesmoothpar.update()
    >>> round_(smooth_min1(1.0, 1.0, derived.highestremotesmoothpar))
    1.0

    """
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        control = self.subpars.pars.control
        if numpy.isinf(control.highestremotedischarge):
            self.value = 0.0
        else:
            self.value = (control.highestremotedischarge *
                          smoothtools.calc_smoothpar_min1(
                              control.highestremotetolerance))


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of the dam model."""
    _PARCLASSES = (TOY,
                   Seconds,
                   RemoteDischargeSmoothPar,
                   NearDischargeMinimumSmoothPar1,
                   NearDischargeMinimumSmoothPar2,
                   WaterLevelMinimumSmoothPar,
                   WaterLevelMinimumRemoteSmoothPar,
                   WaterLevelRelieveSmoothPar,
                   WaterLevelSupplySmoothPar,
                   HighestRemoteSmoothPar)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Inflow(sequencetools.FluxSequence):
    """Total inflow [m³/s]."""
    NDIM, NUMERIC = 0, True


class FloodDischarge(sequencetools.FluxSequence):
    """Water release associated with flood events [m³/s]."""
    NDIM, NUMERIC = 0, True


class TotalRemoteDischarge(sequencetools.FluxSequence):
    """Total discharge at a cross section far downstream [m³/s]."""
    NDIM, NUMERIC = 0, False


class NaturalRemoteDischarge(sequencetools.FluxSequence):
    """Natural discharge at a cross section far downstream [m³/s].

    `Natural` means: without the water released by the dam.
    """
    NDIM, NUMERIC = 0, False


class RemoteDemand(sequencetools.FluxSequence):
    """Discharge demand at a cross section far downstream [m³/s]."""
    NDIM, NUMERIC = 0, False


class RemoteFailure(sequencetools.FluxSequence):
    """Difference between the the actual and the required discharge at
    a cross section far downstream [m³/s]."""
    NDIM, NUMERIC = 0, False


class RequiredRemoteRelease(sequencetools.FluxSequence):
    """Water release considered appropriate to reduce drought events
    at cross sections far downstream to the desired degree [m³/s]."""
    NDIM, NUMERIC = 0, False


class AllowedRemoteRelieve(sequencetools.FluxSequence):
    """Allowed water release to relieve a dam during high
    flow conditions [m³/s]."""
    NDIM, NUMERIC = 0, False


class RequiredRemoteSupply(sequencetools.FluxSequence):
    """Required water supply, e.g. to fill a dam during low water conditions
    [m³/s]."""
    NDIM, NUMERIC = 0, False


class PossibleRemoteRelieve(sequencetools.FluxSequence):
    """Maximum possible water release to a remote location to relieve the
    dam during high flow conditions [m³/s]."""
    NDIM, NUMERIC = 0, True


class ActualRemoteRelieve(sequencetools.FluxSequence):
    """Actual water release to a remote location to relieve the
    dam during high flow conditions [m³/s]."""
    NDIM, NUMERIC = 0, True


class RequiredRelease(sequencetools.FluxSequence):
    """Required water release for reducing drought events downstream [m³/s]."""
    NDIM, NUMERIC = 0, False


class TargetedRelease(sequencetools.FluxSequence):
    """The targeted water release for reducing drought events downstream
    after taking both the required release and additional low flow
    regulations into account [m³/s]."""
    NDIM, NUMERIC = 0, False


class ActualRelease(sequencetools.FluxSequence):
    """Actual water release thought for reducing drought events
    downstream [m³/s]."""
    NDIM, NUMERIC = 0, True


class MissingRemoteRelease(sequencetools.FluxSequence):
    """Amount of the required remote demand that could not be met
    by the actual release [m³/s]."""
    NDIM, NUMERIC = 0, False


class ActualRemoteRelease(sequencetools.FluxSequence):
    """Actual water release thought for arbitrary "remote" purposes [m³/s]."""
    NDIM, NUMERIC = 0, True


class Outflow(sequencetools.FluxSequence):
    """Total outflow [m³/s]."""
    NDIM, NUMERIC = 0, True


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of the dam model."""
    _SEQCLASSES = (Inflow,
                   TotalRemoteDischarge,
                   NaturalRemoteDischarge,
                   RemoteDemand,
                   RemoteFailure,
                   RequiredRemoteRelease,
                   AllowedRemoteRelieve,
                   RequiredRemoteSupply,
                   PossibleRemoteRelieve,
                   ActualRemoteRelieve,
                   RequiredRelease,
                   TargetedRelease,
                   ActualRelease,
                   MissingRemoteRelease,
                   ActualRemoteRelease,
                   FloodDischarge,
                   Outflow)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_inlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Discharge [m³/s]."""
    NDIM, NUMERIC = 0, False


class S(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water supply [m³/s]."""
    NDIM, NUMERIC = 0, False


class R(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water relief [m³/s]."""
    NDIM, NUMERIC = 0, False


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of the dam model."""
    _SEQCLASSES = (Q,
                   S,
                   R)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_logs.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import objecttools
from hydpy.core import sequencetools


class LoggedTotalRemoteDischarge(sequencetools.LogSequence):
    """Logged discharge values from somewhere else [m3/s]."""
    NDIM, NUMERIC = 1, False


class LoggedOutflow(sequencetools.LogSequence):
    """Logged discharge values from the dam itself [m3/s]."""
    NDIM, NUMERIC = 1, False


class ShapeOne(sequencetools.LogSequence):
    """Base class for log sequences with a shape of one.

    Parameter derived from |ShapeOne| are generally initialized
    with a shape of one.  Taking parameter |LoggedRequiredRemoteRelease|
    as an example:

    >>> from hydpy.models.dam import *
    >>> parameterstep()
    >>> logs.loggedrequiredremoterelease.shape
    (1,)

    Trying to set a new shape results in the following exceptions:

    >>> logs.loggedrequiredremoterelease.shape = 2
    Traceback (most recent call last):
    ...
    AttributeError: The shape of parameter `loggedrequiredremoterelease` \
cannot be changed, but this was attempted for element `?`.

    ."""

    def _initvalues(self):
        setattr(self.fastaccess, self.name,
                numpy.full(1, numpy.nan, dtype=float))

    def _setshape(self, shape):
        raise AttributeError(
            'The shape of parameter `%s` cannot be '
            'changed, but this was attempted for element `%s`.'
            % (self.name, objecttools.devicename(self)))

    shape = property(sequencetools.LogSequence._getshape, _setshape)


class LoggedRequiredRemoteRelease(ShapeOne):
    """Logged required discharge values computed by another model [m3/s]."""
    NDIM, NUMERIC = 1, False


class LoggedAllowedRemoteRelieve(ShapeOne):
    """Logged allowed discharge values computed by another model [m3/s]."""
    NDIM, NUMERIC = 1, False


class LogSequences(sequencetools.LogSequences):
    """Log sequences of the dam model."""
    _SEQCLASSES = (LoggedTotalRemoteDischarge,
                   LoggedOutflow,
                   LoggedRequiredRemoteRelease,
                   LoggedAllowedRemoteRelieve)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
1745  
1746  
1747  
1748  
1749  
1750  
1751  
1752  
1753  
1754  
1755  
1756  
1757  
1758  
1759  
1760  
1761  
1762  
1763  
1764  
1765  
1766  
1767  
1768  
1769  
1770  
1771  
1772  
1773  
1774  
1775  
1776  
1777  
1778  
1779  
1780  
1781  
1782  
1783  
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  
1792  
1793  
1794  
1795  
1796  
1797  
1798  
1799  
1800  
1801  
1802  
1803  
1804  
1805  
1806  
1807  
1808  
1809  
1810  
1811  
1812  
1813  
1814  
1815  
1816  
1817  
1818  
1819  
1820  
1821  
1822  
1823  
1824  
1825  
1826  
1827  
1828  
1829  
1830  
1831  
1832  
1833  
1834  
1835  
1836  
1837  
1838  
1839  
1840  
1841  
1842  
1843  
1844  
1845  
1846  
1847  
1848  
1849  
1850  
1851  
1852  
1853  
1854  
1855  
1856  
1857  
1858  
1859  
1860  
1861  
1862  
1863  
1864  
1865  
1866  
1867  
1868  
1869  
1870  
1871  
1872  
1873  
1874  
1875  
1876  
1877  
1878  
1879  
1880  
1881  
1882  
1883  
1884  
1885  
1886  
1887  
1888  
1889  
1890  
1891  
1892  
1893  
1894  
1895  
1896  
1897  
1898  
1899  
1900  
1901  
1902  
1903  
1904  
1905  
1906  
1907  
1908  
1909  
1910  
1911  
1912  
1913  
1914  
1915  
1916  
1917  
1918  
1919  
1920  
1921  
1922  
1923  
1924  
1925  
1926  
1927  
1928  
1929  
1930  
1931  
1932  
1933  
1934  
1935  
1936  
1937  
1938  
1939  
1940  
1941  
1942  
1943  
1944  
1945  
1946  
1947  
1948  
1949  
1950  
1951  
1952  
1953  
1954  
1955  
1956  
1957  
1958  
1959  
1960  
1961  
1962  
1963  
1964  
1965  
1966  
1967  
1968  
1969  
1970  
1971  
1972  
1973  
1974  
1975  
1976  
1977  
1978  
1979  
1980  
1981  
1982  
1983  
1984  
1985  
1986  
1987  
1988  
1989  
1990  
1991  
1992  
1993  
1994  
1995  
1996  
1997  
1998  
1999  
2000  
2001  
2002  
2003  
2004  
2005  
2006  
2007  
2008  
2009  
2010  
2011  
2012  
2013  
2014  
2015  
2016  
2017  
2018  
2019  
2020  
2021  
2022  
2023  
2024  
2025  
2026  
2027  
2028  
2029  
2030  
2031  
2032  
2033  
2034  
2035  
2036  
2037  
2038  
2039  
2040  
2041  
2042  
2043  
2044  
2045  
2046  
2047  
2048  
2049  
2050  
2051  
2052  
2053  
2054  
2055  
2056  
2057  
2058  
2059  
2060  
2061  
2062  
2063  
2064  
2065  
2066  
2067  
2068  
2069  
2070  
2071  
2072  
2073  
2074  
2075  
2076  
2077  
2078  
2079  
2080  
2081  
2082  
2083  
2084  
2085  
2086  
2087  
2088  
2089  
2090  
2091  
2092  
2093  
2094  
2095  
2096  
2097  
2098  
2099  
2100  
2101  
2102  
2103  
2104  
2105  
2106  
2107  
2108  
2109  
2110  
2111  
2112  
2113  
2114  
2115  
2116  
2117  
2118  
2119  
2120  
2121  
2122  
2123  
2124  
2125  
2126  
2127  
2128  
2129  
2130  
2131  
2132  
2133  
2134  
2135  
2136  
2137  
2138  
2139  
2140  
2141  
2142  
2143  
2144  
2145  
2146  
2147  
2148  
2149  
2150  
2151  
2152  
2153  
2154  
2155  
2156  
2157  
2158  
2159  
2160  
2161  
2162  
2163  
2164  
2165  
2166  
2167  
2168  
2169  
2170  
2171  
2172  
2173  
2174  
2175  
2176  
2177  
2178  
2179  
2180  
2181  
2182  
2183  
2184  
2185  
2186  
2187  
2188  
2189  
2190  
2191  
2192  
2193  
2194  
2195  
2196  
2197  
2198  
2199  
2200  
2201  
2202  
2203  
2204  
2205  
2206  
2207  
2208  
2209  
2210  
2211  
2212  
2213  
2214  
2215  
2216  
2217  
2218  
2219  
2220  
2221  
2222  
2223  
2224  
2225  
2226  
2227  
2228  
2229  
2230  
2231  
2232  
2233  
2234  
2235  
2236  
2237  
2238  
2239  
2240  
2241  
2242  
2243  
2244  
2245  
2246  
2247  
2248  
2249  
2250  
2251  
2252  
2253  
2254  
2255  
2256  
2257  
2258  
2259  
2260  
2261  
2262  
2263  
2264  
2265  
2266  
2267  
2268  
2269  
2270  
2271  
2272  
2273  
2274  
2275  
2276  
2277  
2278  
2279  
2280  
2281  
2282  
2283  
2284  
2285  
2286  
2287  
2288  
2289  
2290  
2291  
2292  
2293  
2294  
2295  
2296  
2297  
2298  
2299  
2300  
2301  
2302  
2303  
2304  
2305  
2306  
2307  
2308  
2309  
2310  
2311  
2312  
2313  
2314  
2315  
2316  
2317  
2318  
2319  
2320  
2321  
2322  
2323  
2324  
2325  
2326  
2327  
2328  
2329  
2330  
2331  
2332  
2333  
2334  
2335  
2336  
2337  
2338  
2339  
2340  
2341  
2342  
2343  
2344  
2345  
2346  
2347  
2348  
2349  
2350  
2351  
2352  
2353  
2354  
2355  
2356  
2357  
2358  
2359  
2360  
2361  
2362  
2363  
2364  
2365  
2366  
2367  
2368  
2369  
2370  
2371  
2372  
2373  
2374  
2375  
2376  
2377  
2378  
2379  
2380  
2381  
2382  
2383  
2384  
2385  
2386  
2387  
2388  
2389  
2390  
2391  
2392  
2393  
2394  
2395  
2396  
2397  
2398  
2399  
2400  
2401  
2402  
2403  
2404  
2405  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools
from hydpy.cythons import smoothutils


def pic_inflow_v1(self):
    """Update the inlet link sequence.

    Required inlet sequence:
      |dam_inlets.Q|

    Calculated flux sequence:
      |Inflow|

    Basic equation:
      :math:`Inflow = Q`
    """
    flu = self.sequences.fluxes.fastaccess
    inl = self.sequences.inlets.fastaccess
    flu.inflow = inl.q[0]


def pic_inflow_v2(self):
    """Update the inlet link sequences.

    Required inlet sequences:
      |dam_inlets.Q|
      |dam_inlets.S|
      |dam_inlets.R|

    Calculated flux sequence:
      |Inflow|

    Basic equation:
      :math:`Inflow = Q + S + R`
    """
    flu = self.sequences.fluxes.fastaccess
    inl = self.sequences.inlets.fastaccess
    flu.inflow = inl.q[0]+inl.s[0]+inl.r[0]


def pic_totalremotedischarge_v1(self):
    """Update the receiver link sequence."""
    flu = self.sequences.fluxes.fastaccess
    rec = self.sequences.receivers.fastaccess
    flu.totalremotedischarge = rec.q[0]


def pic_loggedrequiredremoterelease_v1(self):
    """Update the receiver link sequence."""
    log = self.sequences.logs.fastaccess
    rec = self.sequences.receivers.fastaccess
    log.loggedrequiredremoterelease[0] = rec.d[0]


def pic_loggedrequiredremoterelease_v2(self):
    """Update the receiver link sequence."""
    log = self.sequences.logs.fastaccess
    rec = self.sequences.receivers.fastaccess
    log.loggedrequiredremoterelease[0] = rec.s[0]


def pic_loggedallowedremoterelieve_v1(self):
    """Update the receiver link sequence."""
    log = self.sequences.logs.fastaccess
    rec = self.sequences.receivers.fastaccess
    log.loggedallowedremoterelieve[0] = rec.r[0]


def update_loggedtotalremotedischarge_v1(self):
    """Log a new entry of discharge at a cross section far downstream.

    Required control parameter:
      |NmbLogEntries|

    Required flux sequence:
      |TotalRemoteDischarge|

    Calculated flux sequence:
      |LoggedTotalRemoteDischarge|

    Example:

        The following example shows that, with each new method call, the
        three memorized values are successively moved to the right and the
        respective new value is stored on the bare left position:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> nmblogentries(3)
        >>> logs.loggedtotalremotedischarge = 0.0
        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.update_loggedtotalremotedischarge_v1,
        ...                 last_example=4,
        ...                 parseqs=(fluxes.totalremotedischarge,
        ...                          logs.loggedtotalremotedischarge))
        >>> test.nexts.totalremotedischarge = [1., 3., 2., 4]
        >>> del test.inits.loggedtotalremotedischarge
        >>> test()
        | ex. | totalremotedischarge |           loggedtotalremotedischarge |
        ---------------------------------------------------------------------
        |   1 |                  1.0 | 1.0  0.0                         0.0 |
        |   2 |                  3.0 | 3.0  1.0                         0.0 |
        |   3 |                  2.0 | 2.0  3.0                         1.0 |
        |   4 |                  4.0 | 4.0  2.0                         3.0 |
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for idx in range(con.nmblogentries-1, 0, -1):
        log.loggedtotalremotedischarge[idx] = \
                                log.loggedtotalremotedischarge[idx-1]
    log.loggedtotalremotedischarge[0] = flu.totalremotedischarge


def calc_waterlevel_v1(self):
    """Determine the water level based on an artificial neural network
    describing the relationship between water level and water stage.

    Required control parameter:
      |WaterVolume2WaterLevel|

    Required state sequence:
      |WaterVolume|

    Calculated aide sequence:
      |WaterLevel|

    Example:

        Prepare a dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()

        Prepare a very simple relationship based on one single neuron:

        >>> watervolume2waterlevel(
        ...         nmb_inputs=1, nmb_neurons=(1,), nmb_outputs=1,
        ...         weights_input=0.5, weights_output=1.0,
        ...         intercepts_hidden=0.0, intercepts_output=-0.5)

        At least in the water volume range used in the following examples,
        the shape of the relationship looks acceptable:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(
        ...     model, model.calc_waterlevel_v1,
        ...     last_example=10,
        ...     parseqs=(states.watervolume, aides.waterlevel))
        >>> test.nexts.watervolume = range(10)
        >>> test()
        | ex. | watervolume | waterlevel |
        ----------------------------------
        |   1 |         0.0 |        0.0 |
        |   2 |         1.0 |   0.122459 |
        |   3 |         2.0 |   0.231059 |
        |   4 |         3.0 |   0.317574 |
        |   5 |         4.0 |   0.380797 |
        |   6 |         5.0 |   0.424142 |
        |   7 |         6.0 |   0.452574 |
        |   8 |         7.0 |   0.470688 |
        |   9 |         8.0 |   0.482014 |
        |  10 |         9.0 |   0.489013 |

        For more realistic approximations of measured relationships between
        water level and volume, larger neural networks are required.
    """
    con = self.parameters.control.fastaccess
    new = self.sequences.states.fastaccess_new
    aid = self.sequences.aides.fastaccess
    con.watervolume2waterlevel.inputs[0] = new.watervolume
    con.watervolume2waterlevel.process_actual_input()
    aid.waterlevel = con.watervolume2waterlevel.outputs[0]


def calc_allowedremoterelieve_v2(self):
    """Calculate the allowed maximum relieve another location
    is allowed to discharge into the dam.

    Required control parameters:
      |HighestRemoteRelieve|
      |WaterLevelRelieveThreshold|

    Required derived parameter:
      |WaterLevelRelieveSmoothPar|

    Required aide sequence:
      |WaterLevel|

    Calculated flux sequence:
      |AllowedRemoteRelieve|

    Basic equation:
      :math:`ActualRemoteRelease = HighestRemoteRelease \\cdot
      smooth_{logistic1}(WaterLevelRelieveThreshold-WaterLevel,
      WaterLevelRelieveSmoothPar)`

    Used auxiliary method:
      |smooth_logistic1|

    Examples:

        All control parameters that are involved in the calculation of
        |AllowedRemoteRelieve| are derived from |SeasonalParameter|.
        This allows to simulate seasonal dam control schemes.
        To show how this works, we first define a short simulation
        time period of only two days:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Now we prepare the dam model and define two different control
        schemes for the hydrological summer (April to October) and
        winter month (November to May)

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> highestremoterelieve(_11_1_12=1.0, _03_31_12=1.0,
        ...                      _04_1_12=2.0, _10_31_12=2.0)
        >>> waterlevelrelievethreshold(_11_1_12=3.0, _03_31_12=2.0,
        ...                            _04_1_12=4.0, _10_31_12=4.0)
        >>> waterlevelrelievetolerance(_11_1_12=0.0, _03_31_12=0.0,
        ...                            _04_1_12=1.0, _10_31_12=1.0)
        >>> derived.waterlevelrelievesmoothpar.update()
        >>> derived.toy.update()

        The following test function is supposed to calculate
        |AllowedRemoteRelieve| for values of |WaterLevel| ranging
        from 0 and 8 m:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model,
        ...                 model.calc_allowedremoterelieve_v2,
        ...                 last_example=9,
        ...                 parseqs=(aides.waterlevel,
        ...                          fluxes.allowedremoterelieve))
        >>> test.nexts.waterlevel = range(9)

        On March 30 (which is the last day of the winter month and the
        first day of the simulation period), the value of
        |WaterLevelRelieveSmoothPar| is zero.  Hence, |AllowedRemoteRelieve|
        drops abruptly from 1 m³/s (the value of |HighestRemoteRelieve|) to
        0 m³/s, as soon as |WaterLevel| reaches 3 m (the value
        of |WaterLevelRelieveThreshold|):

        >>> model.idx_sim = pub.timegrids.init['2001.03.30']
        >>> test(first_example=2, last_example=6)
        | ex. | waterlevel | allowedremoterelieve |
        -------------------------------------------
        |   3 |        1.0 |                  1.0 |
        |   4 |        2.0 |                  1.0 |
        |   5 |        3.0 |                  0.0 |
        |   6 |        4.0 |                  0.0 |

        On April 1 (which is the first day of the sommer month and the
        last day of the simulation period), all parameter values are
        increased.  The value of parameter |WaterLevelRelieveSmoothPar|
        is 1 m.  Hence, loosely speaking, |AllowedRemoteRelieve| approaches
        the "discontinuous extremes (2 m³/s -- which is the value of
        |HighestRemoteRelieve| -- and 0 m³/s) to 99 % within a span of
        2 m³/s around the original threshold value of 4 m³/s defined by
        |WaterLevelRelieveThreshold|:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | waterlevel | allowedremoterelieve |
        -------------------------------------------
        |   1 |        0.0 |                  2.0 |
        |   2 |        1.0 |             1.999998 |
        |   3 |        2.0 |             1.999796 |
        |   4 |        3.0 |                 1.98 |
        |   5 |        4.0 |                  1.0 |
        |   6 |        5.0 |                 0.02 |
        |   7 |        6.0 |             0.000204 |
        |   8 |        7.0 |             0.000002 |
        |   9 |        8.0 |                  0.0 |
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    toy = der.toy[self.idx_sim]
    flu.allowedremoterelieve = (
        con.highestremoterelieve[toy] *
        smoothutils.smooth_logistic1(
            con.waterlevelrelievethreshold[toy]-aid.waterlevel,
            der.waterlevelrelievesmoothpar[toy]))


def calc_requiredremotesupply_v1(self):
    """Calculate the required maximum supply from another location
    that can be discharged into the dam.

    Required control parameters:
      |HighestRemoteSupply|
      |WaterLevelSupplyThreshold|

    Required derived parameter:
      |WaterLevelSupplySmoothPar|

    Required aide sequence:
      |WaterLevel|

    Calculated flux sequence:
      |RequiredRemoteSupply|

    Basic equation:
      :math:`RequiredRemoteSupply = HighestRemoteSupply \\cdot
      smooth_{logistic1}(WaterLevelSupplyThreshold-WaterLevel,
      WaterLevelSupplySmoothPar)`

    Used auxiliary method:
      |smooth_logistic1|

    Examples:

        Method |calc_requiredremotesupply_v1| is functionally identical
        with method |calc_allowedremoterelieve_v2|.  Hence the following
        examples serve for testing purposes only (see the documentation
        on function |calc_allowedremoterelieve_v2| for more detailed
        information):

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))
        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> highestremotesupply(_11_1_12=1.0, _03_31_12=1.0,
        ...                     _04_1_12=2.0, _10_31_12=2.0)
        >>> waterlevelsupplythreshold(_11_1_12=3.0, _03_31_12=2.0,
        ...                           _04_1_12=4.0, _10_31_12=4.0)
        >>> waterlevelsupplytolerance(_11_1_12=0.0, _03_31_12=0.0,
        ...                           _04_1_12=1.0, _10_31_12=1.0)
        >>> derived.waterlevelsupplysmoothpar.update()
        >>> derived.toy.update()
        >>> from hydpy import UnitTest
        >>> test = UnitTest(model,
        ...                 model.calc_requiredremotesupply_v1,
        ...                 last_example=9,
        ...                 parseqs=(aides.waterlevel,
        ...                          fluxes.requiredremotesupply))
        >>> test.nexts.waterlevel = range(9)
        >>> model.idx_sim = pub.timegrids.init['2001.03.30']
        >>> test(first_example=2, last_example=6)
        | ex. | waterlevel | requiredremotesupply |
        -------------------------------------------
        |   3 |        1.0 |                  1.0 |
        |   4 |        2.0 |                  1.0 |
        |   5 |        3.0 |                  0.0 |
        |   6 |        4.0 |                  0.0 |
        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | waterlevel | requiredremotesupply |
        -------------------------------------------
        |   1 |        0.0 |                  2.0 |
        |   2 |        1.0 |             1.999998 |
        |   3 |        2.0 |             1.999796 |
        |   4 |        3.0 |                 1.98 |
        |   5 |        4.0 |                  1.0 |
        |   6 |        5.0 |                 0.02 |
        |   7 |        6.0 |             0.000204 |
        |   8 |        7.0 |             0.000002 |
        |   9 |        8.0 |                  0.0 |
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    toy = der.toy[self.idx_sim]
    flu.requiredremotesupply = (
        con.highestremotesupply[toy] *
        smoothutils.smooth_logistic1(
            con.waterlevelsupplythreshold[toy]-aid.waterlevel,
            der.waterlevelsupplysmoothpar[toy]))


def calc_naturalremotedischarge_v1(self):
    """Try to estimate the natural discharge of a cross section far downstream
    based on the last few simulation steps.

    Required control parameter:
      |NmbLogEntries|

    Required log sequences:
      |LoggedTotalRemoteDischarge|
      |LoggedOutflow|

    Calculated flux sequence:
      |NaturalRemoteDischarge|

    Basic equation:
      :math:`RemoteDemand =
      max(\\frac{\\Sigma(LoggedTotalRemoteDischarge - LoggedOutflow)}
      {NmbLogEntries}), 0)`

    Examples:

        Usually, the mean total remote flow should be larger than the mean
        dam outflows.  Then the estimated natural remote discharge is simply
        the difference of both mean values:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> nmblogentries(3)
        >>> logs.loggedtotalremotedischarge(2.5, 2.0, 1.5)
        >>> logs.loggedoutflow(2.0, 1.0, 0.0)
        >>> model.calc_naturalremotedischarge_v1()
        >>> fluxes.naturalremotedischarge
        naturalremotedischarge(1.0)

        Due to the wave travel times, the difference between remote discharge
        and dam outflow mights sometimes be negative.  To avoid negative
        estimates of natural discharge, it its value is set to zero in
        such cases:

        >>> logs.loggedoutflow(4.0, 3.0, 5.0)
        >>> model.calc_naturalremotedischarge_v1()
        >>> fluxes.naturalremotedischarge
        naturalremotedischarge(0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    flu.naturalremotedischarge = 0.
    for idx in range(con.nmblogentries):
        flu.naturalremotedischarge += (
            log.loggedtotalremotedischarge[idx] - log.loggedoutflow[idx])
    if flu.naturalremotedischarge > 0.:
        flu.naturalremotedischarge /= con.nmblogentries
    else:
        flu.naturalremotedischarge = 0.


def calc_remotedemand_v1(self):
    """Estimate the discharge demand of a cross section far downstream.

    Required control parameter:
      |RemoteDischargeMinimum|

    Required derived parameters:
      |dam_derived.TOY|

    Required flux sequence:
      |dam_derived.TOY|

    Calculated flux sequence:
      |RemoteDemand|

    Basic equation:
      :math:`RemoteDemand =
      max(RemoteDischargeMinimum - NaturalRemoteDischarge, 0`

    Examples:

        Low water elevation is often restricted to specific month of the year.
        Sometimes the pursued lowest discharge value varies over the year
        to allow for a low flow variability that is in some agreement with
        the natural flow regime.  The HydPy-Dam model supports such
        variations.  Hence we define a short simulation time period first.
        This enables us to show how the related parameters values can be
        defined and how the calculation of the `remote` water demand
        throughout the year actually works:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Prepare the dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()

        Assume the required discharge at a gauge downstream being 2 m³/s
        in the hydrological summer half-year (April to October).  In the
        winter month (November to May), there is no such requirement:

        >>> remotedischargeminimum(_11_1_12=0.0, _03_31_12=0.0,
        ...                        _04_1_12=2.0, _10_31_12=2.0)
        >>> derived.toy.update()

        Prepare a test function, that calculates the remote discharge demand
        based on the parameter values defined above and for natural remote
        discharge values ranging between 0 and 3 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_remotedemand_v1, last_example=4,
        ...                 parseqs=(fluxes.naturalremotedischarge,
        ...                          fluxes.remotedemand))
        >>> test.nexts.naturalremotedischarge = range(4)

        On April 1, the required discharge is 2 m³/s:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | naturalremotedischarge | remotedemand |
        -----------------------------------------------
        |   1 |                    0.0 |          2.0 |
        |   2 |                    1.0 |          1.0 |
        |   3 |                    2.0 |          0.0 |
        |   4 |                    3.0 |          0.0 |

        On May 31, the required discharge is 0 m³/s:

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> test()
        | ex. | naturalremotedischarge | remotedemand |
        -----------------------------------------------
        |   1 |                    0.0 |          0.0 |
        |   2 |                    1.0 |          0.0 |
        |   3 |                    2.0 |          0.0 |
        |   4 |                    3.0 |          0.0 |
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.remotedemand = max(con.remotedischargeminimum[der.toy[self.idx_sim]] -
                           flu.naturalremotedischarge, 0.)


def calc_remotefailure_v1(self):
    """Estimate the shortfall of actual discharge under the required discharge
    of a cross section far downstream.

    Required control parameters:
      |NmbLogEntries|
      |RemoteDischargeMinimum|

    Required derived parameters:
      |dam_derived.TOY|

    Required log sequence:
      |LoggedTotalRemoteDischarge|

    Calculated flux sequence:
      |RemoteFailure|

    Basic equation:
      :math:`RemoteFailure =
      \\frac{\\Sigma(LoggedTotalRemoteDischarge)}{NmbLogEntries} -
      RemoteDischargeMinimum`

    Examples:

        As explained in the documentation on method |calc_remotedemand_v1|,
        we have to define a simulation period first:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Now we prepare a dam model with log sequences memorizing three values:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> nmblogentries(3)

        Again, the required discharge is 2 m³/s in summer and 0 m³/s in winter:

        >>> remotedischargeminimum(_11_1_12=0.0, _03_31_12=0.0,
        ...                        _04_1_12=2.0, _10_31_12=2.0)
        >>> derived.toy.update()

        Let it be supposed that the actual discharge at the remote
        cross section droped from 2 m³/s to 0  m³/s over the last three days:

        >>> logs.loggedtotalremotedischarge(0.0, 1.0, 2.0)

        This means that for the April 1 there would have been an averaged
        shortfall of 1 m³/s:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> model.calc_remotefailure_v1()
        >>> fluxes.remotefailure
        remotefailure(1.0)

        Instead for May 31 there would have been an excess of 1 m³/s, which
        is interpreted to be a "negative failure":

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> model.calc_remotefailure_v1()
        >>> fluxes.remotefailure
        remotefailure(-1.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    flu.remotefailure = 0
    for idx in range(con.nmblogentries):
        flu.remotefailure -= log.loggedtotalremotedischarge[idx]
    flu.remotefailure /= con.nmblogentries
    flu.remotefailure += con.remotedischargeminimum[der.toy[self.idx_sim]]


def calc_requiredremoterelease_v1(self):
    """Guess the required release necessary to not fall below the threshold
    value at a cross section far downstream with a certain level of certainty.

    Required control parameter:
      |RemoteDischargeSafety|

    Required derived parameters:
      |RemoteDischargeSmoothPar|
      |dam_derived.TOY|

    Required flux sequence:
      |RemoteDemand|
      |RemoteFailure|

    Calculated flux sequence:
      |RequiredRemoteRelease|

    Basic equation:
      :math:`RequiredRemoteRelease = RemoteDemand + RemoteDischargeSafety
      \\cdot smooth_{logistic1}(RemoteFailure, RemoteDischargeSmoothPar)`

    Used auxiliary method:
      |smooth_logistic1|

    Examples:

        As in the examples above, define a short simulation time period first:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Prepare the dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.toy.update()

        Define a safety factor of 0.5 m³/s for the summer months and
        no safety factor at all for the winter months:

        >>> remotedischargesafety(_11_1_12=0.0, _03_31_12=0.0,
        ...                       _04_1_12=1.0, _10_31_12=1.0)
        >>> derived.remotedischargesmoothpar.update()

        Assume the actual demand at the cross section downsstream has actually
        been estimated to be 2 m³/s:

        >>> fluxes.remotedemand = 2.0

        Prepare a test function, that calculates the required discharge
        based on the parameter values defined above and for a "remote
        failure" values ranging between -4 and 4 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_requiredremoterelease_v1,
        ...                 last_example=9,
        ...                 parseqs=(fluxes.remotefailure,
        ...                          fluxes.requiredremoterelease))
        >>> test.nexts.remotefailure = range(-4, 5)

        On May 31, the safety factor is 0 m³/s.  Hence no discharge is
        added to the estimated remote demand of 2 m³/s:

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> test()
        | ex. | remotefailure | requiredremoterelease |
        -----------------------------------------------
        |   1 |          -4.0 |                   2.0 |
        |   2 |          -3.0 |                   2.0 |
        |   3 |          -2.0 |                   2.0 |
        |   4 |          -1.0 |                   2.0 |
        |   5 |           0.0 |                   2.0 |
        |   6 |           1.0 |                   2.0 |
        |   7 |           2.0 |                   2.0 |
        |   8 |           3.0 |                   2.0 |
        |   9 |           4.0 |                   2.0 |

        On April 1, the safety factor is 1 m³/s.  If the remote failure was
        exactly zero in the past, meaning the control of the dam was perfect,
        only 0.5 m³/s are added to the estimated remote demand of 2 m³/s.
        If the actual recharge did actually fall below the threshold value,
        up to 1 m³/s is added. If the the actual discharge exceeded the
        threshold value by 2 or 3 m³/s, virtually nothing is added:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | remotefailure | requiredremoterelease |
        -----------------------------------------------
        |   1 |          -4.0 |                   2.0 |
        |   2 |          -3.0 |              2.000001 |
        |   3 |          -2.0 |              2.000102 |
        |   4 |          -1.0 |                  2.01 |
        |   5 |           0.0 |                   2.5 |
        |   6 |           1.0 |                  2.99 |
        |   7 |           2.0 |              2.999898 |
        |   8 |           3.0 |              2.999999 |
        |   9 |           4.0 |                   3.0 |

    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.requiredremoterelease = (
        flu.remotedemand+con.remotedischargesafety[der.toy[self.idx_sim]] *
        smoothutils.smooth_logistic1(
            flu.remotefailure,
            der.remotedischargesmoothpar[der.toy[self.idx_sim]]))


def calc_requiredremoterelease_v2(self):
    """Get the required remote release of the last simulation step.

    Required log sequence:
      |LoggedRequiredRemoteRelease|

    Calculated flux sequence:
      |RequiredRemoteRelease|

    Basic equation:
      :math:`RequiredRemoteRelease = LoggedRequiredRemoteRelease`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> logs.loggedrequiredremoterelease = 3.0
        >>> model.calc_requiredremoterelease_v2()
        >>> fluxes.requiredremoterelease
        requiredremoterelease(3.0)
    """
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    flu.requiredremoterelease = log.loggedrequiredremoterelease[0]


def calc_allowedremoterelieve_v1(self):
    """Get the allowed remote relieve of the last simulation step.

    Required log sequence:
      |LoggedAllowedRemoteRelieve|

    Calculated flux sequence:
      |AllowedRemoteRelieve|

    Basic equation:
      :math:`AllowedRemoteRelieve = LoggedAllowedRemoteRelieve`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> logs.loggedallowedremoterelieve = 2.0
        >>> model.calc_allowedremoterelieve_v1()
        >>> fluxes.allowedremoterelieve
        allowedremoterelieve(2.0)
    """
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    flu.allowedremoterelieve = log.loggedallowedremoterelieve[0]


def calc_requiredrelease_v1(self):
    """Calculate the total water release (immediately and far downstream)
    required for reducing drought events.

    Required control parameter:
      |NearDischargeMinimumThreshold|

    Required derived parameters:
      |NearDischargeMinimumSmoothPar2|
      |dam_derived.TOY|

    Required flux sequence:
      |RequiredRemoteRelease|

    Calculated flux sequence:
      |RequiredRelease|

    Basic equation:
      :math:`RequiredRelease = RequiredRemoteRelease
      \\cdot smooth_{logistic2}(
      RequiredRemoteRelease-NearDischargeMinimumThreshold,
      NearDischargeMinimumSmoothPar2)`

    Used auxiliary method:
      |smooth_logistic2|

    Examples:

        As in the examples above, define a short simulation time period first:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Prepare the dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.toy.update()

        Define a minimum discharge value for a cross section immediately
        downstream of 4 m³/s for the summer months and of 0 m³/s for the
        winter months:

        >>> neardischargeminimumthreshold(_11_1_12=0.0, _03_31_12=0.0,
        ...                               _04_1_12=4.0, _10_31_12=4.0)

        Also define related tolerance values that are 1 m³/s in summer and
        0 m³/s in winter:

        >>> neardischargeminimumtolerance(_11_1_12=0.0, _03_31_12=0.0,
        ...                               _04_1_12=1.0, _10_31_12=1.0)
        >>> derived.neardischargeminimumsmoothpar2.update()

        Prepare a test function, that calculates the required total discharge
        based on the parameter values defined above and for a required value
        for a cross section far downstream ranging from 0 m³/s to 8 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_requiredrelease_v1,
        ...                 last_example=9,
        ...                 parseqs=(fluxes.requiredremoterelease,
        ...                          fluxes.requiredrelease))
        >>> test.nexts.requiredremoterelease = range(9)

        On May 31, both the threshold and the tolerance value are 0 m³/s.
        Hence the required total and the required remote release are equal:

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> test()
        | ex. | requiredremoterelease | requiredrelease |
        -------------------------------------------------
        |   1 |                   0.0 |             0.0 |
        |   2 |                   1.0 |             1.0 |
        |   3 |                   2.0 |             2.0 |
        |   4 |                   3.0 |             3.0 |
        |   5 |                   4.0 |             4.0 |
        |   6 |                   5.0 |             5.0 |
        |   7 |                   6.0 |             6.0 |
        |   8 |                   7.0 |             7.0 |
        |   9 |                   8.0 |             8.0 |

        On April 1, the threshold value is 4 m³/s and the tolerance value
        is 1 m³/s.  For low values of the required remote release, the
        required total release approximates the threshold value. For large
        values, it approximates the required remote release itself.  Around
        the threshold value, due to the tolerance value of 1 m³/s, the
        required total release is a little larger than both the treshold
        value and the required remote release value:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | requiredremoterelease | requiredrelease |
        -------------------------------------------------
        |   1 |                   0.0 |             4.0 |
        |   2 |                   1.0 |        4.000012 |
        |   3 |                   2.0 |        4.000349 |
        |   4 |                   3.0 |            4.01 |
        |   5 |                   4.0 |        4.205524 |
        |   6 |                   5.0 |            5.01 |
        |   7 |                   6.0 |        6.000349 |
        |   8 |                   7.0 |        7.000012 |
        |   9 |                   8.0 |             8.0 |

    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.requiredrelease = con.neardischargeminimumthreshold[
        der.toy[self.idx_sim]]
    flu.requiredrelease = (
        flu.requiredrelease +
        smoothutils.smooth_logistic2(
            flu.requiredremoterelease-flu.requiredrelease,
            der.neardischargeminimumsmoothpar2[
                der.toy[self.idx_sim]]))


def calc_requiredrelease_v2(self):
    """Calculate the water release (immediately downstream) required for
    reducing drought events.

    Required control parameter:
      |NearDischargeMinimumThreshold|

    Required derived parameter:
      |dam_derived.TOY|

    Calculated flux sequence:
      |RequiredRelease|

    Basic equation:
      :math:`RequiredRelease = NearDischargeMinimumThreshold`

    Examples:

        As in the examples above, define a short simulation time period first:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Prepare the dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.toy.update()

        Define a minimum discharge value for a cross section immediately
        downstream of 4 m³/s for the summer months and of 0 m³/s for the
        winter months:

        >>> neardischargeminimumthreshold(_11_1_12=0.0, _03_31_12=0.0,
        ...                               _04_1_12=4.0, _10_31_12=4.0)


        As to be expected, the calculated required release is 0.0 m³/s
        on May 31 and 4.0 m³/s on April 1:

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> model.calc_requiredrelease_v2()
        >>> fluxes.requiredrelease
        requiredrelease(0.0)
        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> model.calc_requiredrelease_v2()
        >>> fluxes.requiredrelease
        requiredrelease(4.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.requiredrelease = con.neardischargeminimumthreshold[
        der.toy[self.idx_sim]]


def calc_possibleremoterelieve_v1(self):
    """Calculate the highest possible water release that can be routed to
    a remote location based on an artificial neural network describing the
    relationship between possible release and water stage.

    Required control parameter:
      |WaterLevel2PossibleRemoteRelieve|

    Required aide sequence:
      |WaterLevel|

    Calculated flux sequence:
      |PossibleRemoteRelieve|

    Example:

        For simplicity, the example of method |calc_flooddischarge_v1|
        is reused.  See the documentation on the mentioned method for
        further information:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> waterlevel2possibleremoterelieve(
        ...     nmb_inputs=1,
        ...     nmb_neurons=(2,),
        ...     nmb_outputs=1,
        ...     weights_input=[[50., 4]],
        ...     weights_output=[[2.], [30]],
        ...     intercepts_hidden=[[-13000, -1046]],
        ...     intercepts_output=[0.])
        >>> from hydpy import UnitTest
        >>> test = UnitTest(
        ...     model, model.calc_possibleremoterelieve_v1,
        ...     last_example=21,
        ...     parseqs=(aides.waterlevel, fluxes.possibleremoterelieve))
        >>> test.nexts.waterlevel = numpy.arange(257, 261.1, 0.2)
        >>> test()
        | ex. | waterlevel | possibleremoterelieve |
        --------------------------------------------
        |   1 |      257.0 |                   0.0 |
        |   2 |      257.2 |              0.000001 |
        |   3 |      257.4 |              0.000002 |
        |   4 |      257.6 |              0.000005 |
        |   5 |      257.8 |              0.000011 |
        |   6 |      258.0 |              0.000025 |
        |   7 |      258.2 |              0.000056 |
        |   8 |      258.4 |              0.000124 |
        |   9 |      258.6 |              0.000275 |
        |  10 |      258.8 |              0.000612 |
        |  11 |      259.0 |              0.001362 |
        |  12 |      259.2 |              0.003031 |
        |  13 |      259.4 |              0.006745 |
        |  14 |      259.6 |              0.015006 |
        |  15 |      259.8 |              0.033467 |
        |  16 |      260.0 |              1.074179 |
        |  17 |      260.2 |              2.164498 |
        |  18 |      260.4 |              2.363853 |
        |  19 |      260.6 |               2.79791 |
        |  20 |      260.8 |              3.719725 |
        |  21 |      261.0 |              5.576088 |
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    con.waterlevel2possibleremoterelieve.inputs[0] = aid.waterlevel
    con.waterlevel2possibleremoterelieve.process_actual_input()
    flu.possibleremoterelieve = con.waterlevel2possibleremoterelieve.outputs[0]


def calc_actualremoterelieve_v1(self):
    """Calculate the actual amount of water released to a remote location
    to relieve the dam during high flow conditions.

    Required control parameter:
      |RemoteRelieveTolerance|

    Required flux sequences:
      |AllowedRemoteRelieve|
      |PossibleRemoteRelieve|

    Calculated flux sequence:
      |ActualRemoteRelieve|

    Basic equation - discontinous:
      :math:`ActualRemoteRelease = min(PossibleRemoteRelease,
      AllowedRemoteRelease)`

    Basic equation - continous:
      :math:`ActualRemoteRelease = smooth_min1(PossibleRemoteRelease,
      AllowedRemoteRelease, RemoteRelieveTolerance)`

    Used auxiliary methods:
      |smooth_min1|
      |smooth_max1|


    Note that the given continous basic equation is a simplification of
    the complete algorithm to calculate |ActualRemoteRelieve|, which also
    makes use of |smooth_max1| to prevent from gaining negative values
    in a smooth manner.


    Examples:

        Prepare a dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()

        Prepare a test function object that performs seven examples with
        |PossibleRemoteRelieve| ranging from -1 to 5 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_actualremoterelieve_v1,
        ...                 last_example=7,
        ...                 parseqs=(fluxes.possibleremoterelieve,
        ...                          fluxes.actualremoterelieve))
        >>> test.nexts.possibleremoterelieve = range(-1, 6)

        We begin with a |AllowedRemoteRelieve| value of 3 m³/s:

        >>> fluxes.allowedremoterelieve = 3.0

        Through setting the value of |RemoteRelieveTolerance| to the
        lowest possible value, there is no smoothing.  Instead, the
        relationship between |ActualRemoteRelieve| and |PossibleRemoteRelieve|
        follows the simple discontinous minimum function:

        >>> remoterelievetolerance(0.0)
        >>> test()
        | ex. | possibleremoterelieve | actualremoterelieve |
        -----------------------------------------------------
        |   1 |                  -1.0 |                 0.0 |
        |   2 |                   0.0 |                 0.0 |
        |   3 |                   1.0 |                 1.0 |
        |   4 |                   2.0 |                 2.0 |
        |   5 |                   3.0 |                 3.0 |
        |   6 |                   4.0 |                 3.0 |
        |   7 |                   5.0 |                 3.0 |

        Increasing the value of parameter |RemoteRelieveTolerance| to a
        sensible value results in a moderate smoothing:

        >>> remoterelievetolerance(0.2)
        >>> test()
        | ex. | possibleremoterelieve | actualremoterelieve |
        -----------------------------------------------------
        |   1 |                  -1.0 |                 0.0 |
        |   2 |                   0.0 |                 0.0 |
        |   3 |                   1.0 |            0.970639 |
        |   4 |                   2.0 |             1.89588 |
        |   5 |                   3.0 |            2.584112 |
        |   6 |                   4.0 |            2.896195 |
        |   7 |                   5.0 |            2.978969 |

        Even when setting a very large smoothing parameter value, the actual
        remote relieve does not fall below 0 m³/s:

        >>> remoterelievetolerance(1.0)
        >>> test()
        | ex. | possibleremoterelieve | actualremoterelieve |
        -----------------------------------------------------
        |   1 |                  -1.0 |                 0.0 |
        |   2 |                   0.0 |                 0.0 |
        |   3 |                   1.0 |            0.306192 |
        |   4 |                   2.0 |            0.634882 |
        |   5 |                   3.0 |            1.037708 |
        |   6 |                   4.0 |            1.436494 |
        |   7 |                   5.0 |            1.788158 |

        Now we repeat the last example with a allowed remote relieve of
        only 0.03 m³/s instead of 3 m³/s:

        >>> fluxes.allowedremoterelieve = 0.03
        >>> test()
        | ex. | possibleremoterelieve | actualremoterelieve |
        -----------------------------------------------------
        |   1 |                  -1.0 |                 0.0 |
        |   2 |                   0.0 |                 0.0 |
        |   3 |                   1.0 |                0.03 |
        |   4 |                   2.0 |                0.03 |
        |   5 |                   3.0 |                0.03 |
        |   6 |                   4.0 |                0.03 |
        |   7 |                   5.0 |                0.03 |

        The result above is as expected, but the smooth part of the
        relationship is not resolved.  By increasing the resolution we
        see a relationship that corresponds to the one shown above
        for an allowed relieve of 3 m³/s.  This points out, that the
        degree of smoothing is releative to the allowed relieve:

        >>> import numpy
        >>> test.nexts.possibleremoterelieve = numpy.arange(-0.01, 0.06, 0.01)
        >>> test()
        | ex. | possibleremoterelieve | actualremoterelieve |
        -----------------------------------------------------
        |   1 |                 -0.01 |                 0.0 |
        |   2 |                   0.0 |                 0.0 |
        |   3 |                  0.01 |            0.003062 |
        |   4 |                  0.02 |            0.006349 |
        |   5 |                  0.03 |            0.010377 |
        |   6 |                  0.04 |            0.014365 |
        |   7 |                  0.05 |            0.017882 |

        One can reperform the shown experiments with an even higher
        resolution to see that the relationship between
        |ActualRemoteRelieve| and |PossibleRemoteRelieve| is
        (at least in most cases) in fact very smooth.  But a more analytical
        approach would possibly be favourable regarding the smoothness in
        some edge cases and computational efficiency.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    d_smoothpar = con.remoterelievetolerance*flu.allowedremoterelieve
    flu.actualremoterelieve = smoothutils.smooth_min1(
        flu.possibleremoterelieve, flu.allowedremoterelieve, d_smoothpar)
    for dummy in range(5):
        d_smoothpar /= 5.
        flu.actualremoterelieve = smoothutils.smooth_max1(
            flu.actualremoterelieve, 0., d_smoothpar)
        d_smoothpar /= 5.
        flu.actualremoterelieve = smoothutils.smooth_min1(
            flu.actualremoterelieve, flu.possibleremoterelieve, d_smoothpar)
    flu.actualremoterelieve = min(flu.actualremoterelieve,
                                  flu.possibleremoterelieve)
    flu.actualremoterelieve = min(flu.actualremoterelieve,
                                  flu.allowedremoterelieve)
    flu.actualremoterelieve = max(flu.actualremoterelieve, 0.)


def calc_targetedrelease_v1(self):
    """Calculate the targeted water release for reducing drought events,
    taking into account both the required water release and the actual
    inflow into the dam.

    Some dams are supposed to maintain a certain degree of low flow
    variability downstream.  In case parameter |RestrictTargetedRelease|
    is set to `True`, method |calc_targetedrelease_v1| simulates
    this by (approximately) passing inflow as outflow whenever inflow
    is below the value of the threshold parameter
    |NearDischargeMinimumThreshold|. If parameter |RestrictTargetedRelease|
    is set to `False`, does nothing except assigning the value of sequence
    |RequiredRelease| to sequence |TargetedRelease|.

    Required control parameter:
      |RestrictTargetedRelease|
      |NearDischargeMinimumThreshold|

    Required derived parameters:
      |NearDischargeMinimumSmoothPar1|
      |dam_derived.TOY|

    Required flux sequence:
      |RequiredRelease|

    Calculated flux sequence:
      |TargetedRelease|

    Used auxiliary method:
      |smooth_logistic1|

    Basic equation:
      :math:`TargetedRelease =
      w \\cdot RequiredRelease + (1-w) \\cdot Inflow`

      :math:`w = smooth_{logistic1}(
      Inflow-NearDischargeMinimumThreshold, NearDischargeMinimumSmoothPar1)`

    Examples:

        As in the examples above, define a short simulation time period first:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.03.30',
        ...                                    '2001.04.03',
        ...                                    '1d'))

        Prepare the dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.toy.update()

        We start with enabling |RestrictTargetedRelease|:

        >>> restricttargetedrelease(True)

        Define a minimum discharge value for a cross section immediately
        downstream of 6 m³/s for the summer months and of 4 m³/s for the
        winter months:

        >>> neardischargeminimumthreshold(_11_1_12=6.0, _03_31_12=6.0,
        ...                               _04_1_12=4.0, _10_31_12=4.0)

        Also define related tolerance values that are 1 m³/s in summer and
        0 m³/s in winter:

        >>> neardischargeminimumtolerance(_11_1_12=0.0, _03_31_12=0.0,
        ...                               _04_1_12=2.0, _10_31_12=2.0)
        >>> derived.neardischargeminimumsmoothpar1.update()

        Prepare a test function that calculates the targeted water release
        based on the parameter values defined above and for inflows into
        the dam ranging from 0 m³/s to 10 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_targetedrelease_v1,
        ...                 last_example=21,
        ...                 parseqs=(fluxes.inflow,
        ...                          fluxes.targetedrelease))
        >>> test.nexts.inflow = numpy.arange(0.0, 10.5, .5)

        Firstly, assume the required release of water for reducing droughts
        has already been determined to be 10 m³/s:

        >>> fluxes.requiredrelease = 10.

        On May 31, the tolerance value is 0 m³/s.  Hence the targeted
        release jumps from the inflow value to the required release
        when exceeding the threshold value of 6 m³/s:

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |             0.0 |
        |   2 |    0.5 |             0.5 |
        |   3 |    1.0 |             1.0 |
        |   4 |    1.5 |             1.5 |
        |   5 |    2.0 |             2.0 |
        |   6 |    2.5 |             2.5 |
        |   7 |    3.0 |             3.0 |
        |   8 |    3.5 |             3.5 |
        |   9 |    4.0 |             4.0 |
        |  10 |    4.5 |             4.5 |
        |  11 |    5.0 |             5.0 |
        |  12 |    5.5 |             5.5 |
        |  13 |    6.0 |             8.0 |
        |  14 |    6.5 |            10.0 |
        |  15 |    7.0 |            10.0 |
        |  16 |    7.5 |            10.0 |
        |  17 |    8.0 |            10.0 |
        |  18 |    8.5 |            10.0 |
        |  19 |    9.0 |            10.0 |
        |  20 |    9.5 |            10.0 |
        |  21 |   10.0 |            10.0 |

        On April 1, the threshold value is 4 m³/s and the tolerance value
        is 2 m³/s.  Hence there is a smooth transition for inflows ranging
        between 2 m³/s and 6 m³/s:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |         0.00102 |
        |   2 |    0.5 |        0.503056 |
        |   3 |    1.0 |        1.009127 |
        |   4 |    1.5 |        1.527132 |
        |   5 |    2.0 |            2.08 |
        |   6 |    2.5 |        2.731586 |
        |   7 |    3.0 |        3.639277 |
        |   8 |    3.5 |        5.064628 |
        |   9 |    4.0 |             7.0 |
        |  10 |    4.5 |        8.676084 |
        |  11 |    5.0 |        9.543374 |
        |  12 |    5.5 |        9.861048 |
        |  13 |    6.0 |            9.96 |
        |  14 |    6.5 |        9.988828 |
        |  15 |    7.0 |        9.996958 |
        |  16 |    7.5 |        9.999196 |
        |  17 |    8.0 |        9.999796 |
        |  18 |    8.5 |        9.999951 |
        |  19 |    9.0 |         9.99999 |
        |  20 |    9.5 |        9.999998 |
        |  21 |   10.0 |            10.0 |


        An required release substantially below the threshold value is
        a rather unlikely scenario, but is at least instructive regarding
        the functioning of the method (when plotting the results
        graphically...):

        >>> fluxes.requiredrelease = 2.

        On May 31, the relationship between targeted release and inflow
        is again highly discontinous:

        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |             0.0 |
        |   2 |    0.5 |             0.5 |
        |   3 |    1.0 |             1.0 |
        |   4 |    1.5 |             1.5 |
        |   5 |    2.0 |             2.0 |
        |   6 |    2.5 |             2.5 |
        |   7 |    3.0 |             3.0 |
        |   8 |    3.5 |             3.5 |
        |   9 |    4.0 |             4.0 |
        |  10 |    4.5 |             4.5 |
        |  11 |    5.0 |             5.0 |
        |  12 |    5.5 |             5.5 |
        |  13 |    6.0 |             4.0 |
        |  14 |    6.5 |             2.0 |
        |  15 |    7.0 |             2.0 |
        |  16 |    7.5 |             2.0 |
        |  17 |    8.0 |             2.0 |
        |  18 |    8.5 |             2.0 |
        |  19 |    9.0 |             2.0 |
        |  20 |    9.5 |             2.0 |
        |  21 |   10.0 |             2.0 |

        And on April 1, it is again absolutely smooth:

        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |        0.000204 |
        |   2 |    0.5 |        0.500483 |
        |   3 |    1.0 |        1.001014 |
        |   4 |    1.5 |        1.501596 |
        |   5 |    2.0 |             2.0 |
        |   6 |    2.5 |        2.484561 |
        |   7 |    3.0 |        2.908675 |
        |   8 |    3.5 |        3.138932 |
        |   9 |    4.0 |             3.0 |
        |  10 |    4.5 |         2.60178 |
        |  11 |    5.0 |        2.273976 |
        |  12 |    5.5 |        2.108074 |
        |  13 |    6.0 |            2.04 |
        |  14 |    6.5 |        2.014364 |
        |  15 |    7.0 |        2.005071 |
        |  16 |    7.5 |         2.00177 |
        |  17 |    8.0 |        2.000612 |
        |  18 |    8.5 |         2.00021 |
        |  19 |    9.0 |        2.000072 |
        |  20 |    9.5 |        2.000024 |
        |  21 |   10.0 |        2.000008 |

        For required releases equal with the threshold value, there is
        generally no jump in the relationship.  But on May 31, there
        remains a discontinuity in the first derivative:

        >>> fluxes.requiredrelease = 6.
        >>> model.idx_sim = pub.timegrids.init['2001.03.31']
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |             0.0 |
        |   2 |    0.5 |             0.5 |
        |   3 |    1.0 |             1.0 |
        |   4 |    1.5 |             1.5 |
        |   5 |    2.0 |             2.0 |
        |   6 |    2.5 |             2.5 |
        |   7 |    3.0 |             3.0 |
        |   8 |    3.5 |             3.5 |
        |   9 |    4.0 |             4.0 |
        |  10 |    4.5 |             4.5 |
        |  11 |    5.0 |             5.0 |
        |  12 |    5.5 |             5.5 |
        |  13 |    6.0 |             6.0 |
        |  14 |    6.5 |             6.0 |
        |  15 |    7.0 |             6.0 |
        |  16 |    7.5 |             6.0 |
        |  17 |    8.0 |             6.0 |
        |  18 |    8.5 |             6.0 |
        |  19 |    9.0 |             6.0 |
        |  20 |    9.5 |             6.0 |
        |  21 |   10.0 |             6.0 |

        On April 1, this second order discontinuity is smoothed with
        the help of a little hump around the threshold:

        >>> fluxes.requiredrelease = 4.
        >>> model.idx_sim = pub.timegrids.init['2001.04.01']
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |        0.000408 |
        |   2 |    0.5 |        0.501126 |
        |   3 |    1.0 |        1.003042 |
        |   4 |    1.5 |         1.50798 |
        |   5 |    2.0 |            2.02 |
        |   6 |    2.5 |        2.546317 |
        |   7 |    3.0 |        3.091325 |
        |   8 |    3.5 |        3.620356 |
        |   9 |    4.0 |             4.0 |
        |  10 |    4.5 |        4.120356 |
        |  11 |    5.0 |        4.091325 |
        |  12 |    5.5 |        4.046317 |
        |  13 |    6.0 |            4.02 |
        |  14 |    6.5 |         4.00798 |
        |  15 |    7.0 |        4.003042 |
        |  16 |    7.5 |        4.001126 |
        |  17 |    8.0 |        4.000408 |
        |  18 |    8.5 |        4.000146 |
        |  19 |    9.0 |        4.000051 |
        |  20 |    9.5 |        4.000018 |
        |  21 |   10.0 |        4.000006 |

        Repeating the above example with the |RestrictTargetedRelease| flag
        disabled results in identical values for sequences |RequiredRelease|
        and |TargetedRelease|:

        >>> restricttargetedrelease(False)
        >>> test()
        | ex. | inflow | targetedrelease |
        ----------------------------------
        |   1 |    0.0 |             4.0 |
        |   2 |    0.5 |             4.0 |
        |   3 |    1.0 |             4.0 |
        |   4 |    1.5 |             4.0 |
        |   5 |    2.0 |             4.0 |
        |   6 |    2.5 |             4.0 |
        |   7 |    3.0 |             4.0 |
        |   8 |    3.5 |             4.0 |
        |   9 |    4.0 |             4.0 |
        |  10 |    4.5 |             4.0 |
        |  11 |    5.0 |             4.0 |
        |  12 |    5.5 |             4.0 |
        |  13 |    6.0 |             4.0 |
        |  14 |    6.5 |             4.0 |
        |  15 |    7.0 |             4.0 |
        |  16 |    7.5 |             4.0 |
        |  17 |    8.0 |             4.0 |
        |  18 |    8.5 |             4.0 |
        |  19 |    9.0 |             4.0 |
        |  20 |    9.5 |             4.0 |
        |  21 |   10.0 |             4.0 |
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    if con.restricttargetedrelease:
        flu.targetedrelease = smoothutils.smooth_logistic1(
            flu.inflow-con.neardischargeminimumthreshold[
                der.toy[self.idx_sim]],
            der.neardischargeminimumsmoothpar1[der.toy[self.idx_sim]])
        flu.targetedrelease = (flu.targetedrelease * flu.requiredrelease +
                               (1.-flu.targetedrelease) * flu.inflow)
    else:
        flu.targetedrelease = flu.requiredrelease


def calc_actualrelease_v1(self):
    """Calculate the actual water release that can be supplied by the
    dam considering the targeted release and the given water level.

    Required control parameter:
      |WaterLevelMinimumThreshold|

    Required derived parameters:
      |WaterLevelMinimumSmoothPar|

    Required flux sequence:
      |TargetedRelease|

    Required aide sequence:
      |WaterLevel|

    Calculated flux sequence:
      |ActualRelease|

    Basic equation:
      :math:`ActualRelease = TargetedRelease \\cdot
      smooth_{logistic1}(WaterLevelMinimumThreshold-WaterLevel,
      WaterLevelMinimumSmoothPar)`

    Used auxiliary method:
      |smooth_logistic1|

    Examples:

        Prepare the dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()

        Assume the required release has previously been estimated
        to be 2 m³/s:

        >>> fluxes.targetedrelease = 2.0

        Prepare a test function, that calculates the targeted water release
        for water levels ranging between -1 and 5 m:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_actualrelease_v1,
        ...                 last_example=7,
        ...                 parseqs=(aides.waterlevel,
        ...                          fluxes.actualrelease))
        >>> test.nexts.waterlevel = range(-1, 6)

        .. _dam_calc_actualrelease_v1_ex01:

        **Example 1**

        Firstly, we define a sharp minimum water level of 0 m:

        >>> waterlevelminimumthreshold(0.)
        >>> waterlevelminimumtolerance(0.)
        >>> derived.waterlevelminimumsmoothpar.update()

        The following test results show that the water releae is reduced
        to 0 m³/s for water levels (even slightly) lower than 0 m and is
        identical with the required value of 2 m³/s (even slighlty) above 0 m:

        >>> test()
        | ex. | waterlevel | actualrelease |
        ------------------------------------
        |   1 |       -1.0 |           0.0 |
        |   2 |        0.0 |           1.0 |
        |   3 |        1.0 |           2.0 |
        |   4 |        2.0 |           2.0 |
        |   5 |        3.0 |           2.0 |
        |   6 |        4.0 |           2.0 |
        |   7 |        5.0 |           2.0 |


        One may have noted that in the above example the calculated water
        release is 1 m³/s (which is exactly the half of the targeted release)
        at a water level of 1 m.  This looks suspiciously lake a flaw but
        is not of any importance considering the fact, that numerical
        integration algorithms will approximate the analytical solution
        of a complete emptying of a dam emtying (which is a water level
        of 0 m), only with a certain accuracy.

        .. _dam_calc_actualrelease_v1_ex02:

        **Example 2**

        Nonetheless, it can (besides some other possible advantages)
        dramatically increase the speed of numerical integration algorithms
        to define a smooth transition area instead of sharp threshold value,
        like in the following example:

        >>> waterlevelminimumthreshold(4.)
        >>> waterlevelminimumtolerance(1.)
        >>> derived.waterlevelminimumsmoothpar.update()

        Now, 98 % of the variation of the total range from 0 m³/s to 2 m³/s
        occurs between a water level of 3 m and 5 m:

        >>> test()
        | ex. | waterlevel | actualrelease |
        ------------------------------------
        |   1 |       -1.0 |           0.0 |
        |   2 |        0.0 |           0.0 |
        |   3 |        1.0 |      0.000002 |
        |   4 |        2.0 |      0.000204 |
        |   5 |        3.0 |          0.02 |
        |   6 |        4.0 |           1.0 |
        |   7 |        5.0 |          1.98 |

        .. _dam_calc_actualrelease_v1_ex03:

        **Example 3**

        Note that it is possible to set both parameters in a manner that
        might result in negative water stages beyond numerical inaccuracy:

        >>> waterlevelminimumthreshold(1.)
        >>> waterlevelminimumtolerance(2.)
        >>> derived.waterlevelminimumsmoothpar.update()

        Here, the actual water release is 0.18 m³/s for a water level
        of 0 m.  Hence water stages in the range of 0 m to -1 m or
        even -2 m might occur during the simulation of long drought events:

        >>> test()
        | ex. | waterlevel | actualrelease |
        ------------------------------------
        |   1 |       -1.0 |          0.02 |
        |   2 |        0.0 |       0.18265 |
        |   3 |        1.0 |           1.0 |
        |   4 |        2.0 |       1.81735 |
        |   5 |        3.0 |          1.98 |
        |   6 |        4.0 |      1.997972 |
        |   7 |        5.0 |      1.999796 |

    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    flu.actualrelease = (flu.targetedrelease *
                         smoothutils.smooth_logistic1(
                             aid.waterlevel-con.waterlevelminimumthreshold,
                             der.waterlevelminimumsmoothpar))


def calc_missingremoterelease_v1(self):
    """Calculate the portion of the required remote demand that could not
    be met by the actual discharge release.

    Required flux sequences:
      |RequiredRemoteRelease|
      |ActualRelease|

    Calculated flux sequence:
      |MissingRemoteRelease|

    Basic equation:
      :math:`MissingRemoteRelease = max(
      RequiredRemoteRelease-ActualRelease, 0)`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> fluxes.requiredremoterelease = 2.0
        >>> fluxes.actualrelease = 1.0
        >>> model.calc_missingremoterelease_v1()
        >>> fluxes.missingremoterelease
        missingremoterelease(1.0)
        >>> fluxes.actualrelease = 3.0
        >>> model.calc_missingremoterelease_v1()
        >>> fluxes.missingremoterelease
        missingremoterelease(0.0)
    """
    flu = self.sequences.fluxes.fastaccess
    flu.missingremoterelease = max(
        flu.requiredremoterelease-flu.actualrelease, 0.)


def calc_actualremoterelease_v1(self):
    """Calculate the actual remote water release that can be supplied by the
    dam considering the required remote release and the given water level.

    Required control parameter:
      |WaterLevelMinimumRemoteThreshold|

    Required derived parameters:
      |WaterLevelMinimumRemoteSmoothPar|

    Required flux sequence:
      |RequiredRemoteRelease|

    Required aide sequence:
      |WaterLevel|

    Calculated flux sequence:
      |ActualRemoteRelease|

    Basic equation:
      :math:`ActualRemoteRelease = RequiredRemoteRelease \\cdot
      smooth_{logistic1}(WaterLevelMinimumRemoteThreshold-WaterLevel,
      WaterLevelMinimumRemoteSmoothPar)`

    Used auxiliary method:
      |smooth_logistic1|

    Examples:

        Note that method |calc_actualremoterelease_v1| is functionally
        identical with method |calc_actualrelease_v1|.  This is why we
        omit to explain the following examples, as they are just repetitions
        of the ones of method |calc_actualremoterelease_v1| with partly
        different variable names.  Please follow the links to read the
        corresponding explanations.

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> fluxes.requiredremoterelease = 2.0
        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_actualremoterelease_v1,
        ...                 last_example=7,
        ...                 parseqs=(aides.waterlevel,
        ...                          fluxes.actualremoterelease))
        >>> test.nexts.waterlevel = range(-1, 6)

        :ref:`Recalculation of example 1 <dam_calc_actualrelease_v1_ex01>`

        >>> waterlevelminimumremotethreshold(0.)
        >>> waterlevelminimumremotetolerance(0.)
        >>> derived.waterlevelminimumremotesmoothpar.update()
        >>> test()
        | ex. | waterlevel | actualremoterelease |
        ------------------------------------------
        |   1 |       -1.0 |                 0.0 |
        |   2 |        0.0 |                 1.0 |
        |   3 |        1.0 |                 2.0 |
        |   4 |        2.0 |                 2.0 |
        |   5 |        3.0 |                 2.0 |
        |   6 |        4.0 |                 2.0 |
        |   7 |        5.0 |                 2.0 |


        :ref:`Recalculation of example 2 <dam_calc_actualrelease_v1_ex02>`

        >>> waterlevelminimumremotethreshold(4.)
        >>> waterlevelminimumremotetolerance(1.)
        >>> derived.waterlevelminimumremotesmoothpar.update()
        >>> test()
        | ex. | waterlevel | actualremoterelease |
        ------------------------------------------
        |   1 |       -1.0 |                 0.0 |
        |   2 |        0.0 |                 0.0 |
        |   3 |        1.0 |            0.000002 |
        |   4 |        2.0 |            0.000204 |
        |   5 |        3.0 |                0.02 |
        |   6 |        4.0 |                 1.0 |
        |   7 |        5.0 |                1.98 |

        :ref:`Recalculation of example 3 <dam_calc_actualrelease_v1_ex03>`

        >>> waterlevelminimumremotethreshold(1.)
        >>> waterlevelminimumremotetolerance(2.)
        >>> derived.waterlevelminimumremotesmoothpar.update()
        >>> test()
        | ex. | waterlevel | actualremoterelease |
        ------------------------------------------
        |   1 |       -1.0 |                0.02 |
        |   2 |        0.0 |             0.18265 |
        |   3 |        1.0 |                 1.0 |
        |   4 |        2.0 |             1.81735 |
        |   5 |        3.0 |                1.98 |
        |   6 |        4.0 |            1.997972 |
        |   7 |        5.0 |            1.999796 |
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    flu.actualremoterelease = (
        flu.requiredremoterelease *
        smoothutils.smooth_logistic1(
            aid.waterlevel-con.waterlevelminimumremotethreshold,
            der.waterlevelminimumremotesmoothpar))


def update_actualremoterelieve_v1(self):
    """Constrain the actual relieve discharge to a remote location.

    Required control parameter:
      |HighestRemoteDischarge|

    Required derived parameter:
      |HighestRemoteSmoothPar|

    Updated flux sequence:
      |ActualRemoteRelieve|

    Basic equation - discontinous:
      :math:`ActualRemoteRelieve = min(ActualRemoteRelease,
      HighestRemoteDischarge)`

    Basic equation - continous:
      :math:`ActualRemoteRelieve = smooth_min1(ActualRemoteRelieve,
      HighestRemoteDischarge, HighestRemoteSmoothPar)`

    Used auxiliary methods:
      |smooth_min1|
      |smooth_max1|

    Note that the given continous basic equation is a simplification of
    the complete algorithm to update |ActualRemoteRelieve|, which also
    makes use of |smooth_max1| to prevent from gaining negative values
    in a smooth manner.

    Examples:

        Prepare a dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()

        Prepare a test function object that performs eight examples with
        |ActualRemoteRelieve| ranging from 0 to 8 m³/s and a fixed
        initial value of parameter |HighestRemoteDischarge| of 4 m³/s:

        >>> highestremotedischarge(4.0)
        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.update_actualremoterelieve_v1,
        ...                 last_example=8,
        ...                 parseqs=(fluxes.actualremoterelieve,))
        >>> test.nexts.actualremoterelieve = range(8)

        Through setting the value of |HighestRemoteTolerance| to the
        lowest possible value, there is no smoothing.  Instead, the
        shown relationship agrees with a combination of the discontinuous
        minimum and maximum function:

        >>> highestremotetolerance(0.0)
        >>> derived.highestremotesmoothpar.update()
        >>> test()
        | ex. | actualremoterelieve |
        -----------------------------
        |   1 |                 0.0 |
        |   2 |                 1.0 |
        |   3 |                 2.0 |
        |   4 |                 3.0 |
        |   5 |                 4.0 |
        |   6 |                 4.0 |
        |   7 |                 4.0 |
        |   8 |                 4.0 |

        Setting a sensible |HighestRemoteTolerance| value results in
        a moderate smoothing:

        >>> highestremotetolerance(0.1)
        >>> derived.highestremotesmoothpar.update()
        >>> test()
        | ex. | actualremoterelieve |
        -----------------------------
        |   1 |                 0.0 |
        |   2 |            0.999999 |
        |   3 |             1.99995 |
        |   4 |            2.996577 |
        |   5 |            3.836069 |
        |   6 |            3.991578 |
        |   7 |            3.993418 |
        |   8 |            3.993442 |

        Method |update_actualremoterelieve_v1| is defined in a similar
        way as method |calc_actualremoterelieve_v1|.  Please read the
        documentation on |calc_actualremoterelieve_v1| for further
        information.
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    d_smooth = der.highestremotesmoothpar
    d_highest = con.highestremotedischarge
    d_value = smoothutils.smooth_min1(
        flu.actualremoterelieve, d_highest, d_smooth)
    for dummy in range(5):
        d_smooth /= 5.
        d_value = smoothutils.smooth_max1(
            d_value, 0., d_smooth)
        d_smooth /= 5.
        d_value = smoothutils.smooth_min1(
            d_value, d_highest, d_smooth)
    d_value = min(d_value, flu.actualremoterelieve)
    d_value = min(d_value, d_highest)
    flu.actualremoterelieve = max(d_value, 0.)


def update_actualremoterelease_v1(self):
    """Constrain the actual release (supply discharge) to a remote location.

    Required control parameter:
      |HighestRemoteDischarge|

    Required derived parameter:
      |HighestRemoteSmoothPar|

    Required flux sequences:
      |ActualRemoteRelieve|

    Updated flux sequence:
      |ActualRemoteRelease|

    Basic equation - discontinous:
      :math:`ActualRemoteRelease = min(ActualRemoteRelease,
      HighestRemoteDischarge-ActualRemoteRelieve)`

    Basic equation - continous:
      :math:`ActualRemoteRelease = smooth_min1(ActualRemoteRelease,
      HighestRemoteDischarge-ActualRemoteRelieve, HighestRemoteSmoothPar)`

    Used auxiliary methods:
      |smooth_min1|
      |smooth_max1|

    Note that the given continous basic equation is a simplification of
    the complete algorithm to update |ActualRemoteRelease|, which also
    makes use of |smooth_max1| to prevent from gaining negative values
    in a smooth manner.

    Examples:

        Prepare a dam model:

        >>> from hydpy.models.dam import *
        >>> parameterstep()

        Prepare a test function object that performs eight examples with
        |ActualRemoteRelieve| ranging from 0 to 8 m³/s and a fixed initial
        value of parameter |ActualRemoteRelease| of 2 m³/s:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.update_actualremoterelease_v1,
        ...                 last_example=8,
        ...                 parseqs=(fluxes.actualremoterelieve,
        ...                          fluxes.actualremoterelease))
        >>> test.nexts.actualremoterelieve = range(8)
        >>> test.inits.actualremoterelease = 2.0

        Through setting the value of |HighestRemoteTolerance| to the
        lowest possible value, there is no smoothing.  Instead, the
        shown relationship agrees with a combination of the discontinuous
        minimum and maximum function:

        >>> highestremotedischarge(6.0)
        >>> highestremotetolerance(0.0)
        >>> derived.highestremotesmoothpar.update()
        >>> test()
        | ex. | actualremoterelieve | actualremoterelease |
        ---------------------------------------------------
        |   1 |                 0.0 |                 2.0 |
        |   2 |                 1.0 |                 2.0 |
        |   3 |                 2.0 |                 2.0 |
        |   4 |                 3.0 |                 2.0 |
        |   5 |                 4.0 |                 2.0 |
        |   6 |                 5.0 |                 1.0 |
        |   7 |                 6.0 |                 0.0 |
        |   8 |                 7.0 |                 0.0 |

        Setting a sensible |HighestRemoteTolerance| value results in
        a moderate smoothing.  But note that this is only true for
        the minimum function (restricting the larger
        |ActualRemoteRelease| values).  Instead of smoothing the
        maximum function as well, |ActualRemoteRelease| is exactly
        0 m³/s for a |ActualRemoteRelieve| value of 6 m³/s (within
        the shown precision). The remaining discontinuity does not
        pose a problem, as long |ActualRemoteRelieve| does not exceed
        the value of |HighestRemoteDischarge|.  (Application models
        using method |update_actualremoterelease_v1| should generally
        enforce this restriction). In case of exceedance, extended
        computation times might occur:

        >>> highestremotetolerance(0.1)
        >>> derived.highestremotesmoothpar.update()
        >>> test()
        | ex. | actualremoterelieve | actualremoterelease |
        ---------------------------------------------------
        |   1 |                 0.0 |            1.999996 |
        |   2 |                 1.0 |            1.999925 |
        |   3 |                 2.0 |            1.998739 |
        |   4 |                 3.0 |            1.979438 |
        |   5 |                 4.0 |            1.754104 |
        |   6 |                 5.0 |            0.976445 |
        |   7 |                 6.0 |                 0.0 |
        |   8 |                 7.0 |                 0.0 |

        Method |update_actualremoterelease_v1| is defined in a similar
        way as method |calc_actualremoterelieve_v1|.  Please read the
        documentation on |calc_actualremoterelieve_v1| for further
        information.
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    d_smooth = der.highestremotesmoothpar
    d_highest = con.highestremotedischarge-flu.actualremoterelieve
    d_value = smoothutils.smooth_min1(
        flu.actualremoterelease, d_highest, d_smooth)
    for dummy in range(5):
        d_smooth /= 5.
        d_value = smoothutils.smooth_max1(
            d_value, 0., d_smooth)
        d_smooth /= 5.
        d_value = smoothutils.smooth_min1(
            d_value, d_highest, d_smooth)
    d_value = min(d_value, flu.actualremoterelease)
    d_value = min(d_value, d_highest)
    flu.actualremoterelease = max(d_value, 0.)


def calc_flooddischarge_v1(self):
    """Calculate the discharge during and after a flood event based on an
    |anntools.SeasonalANN| describing the relationship(s) between discharge
    and water stage.

    Required control parameter:
      |WaterLevel2FloodDischarge|

    Required derived parameter:
      |dam_derived.TOY|

    Required aide sequence:
      |WaterLevel|

    Calculated flux sequence:
      |FloodDischarge|

    Example:


        The control parameter |WaterLevel2FloodDischarge| is derived from
        |SeasonalParameter|.  This allows to simulate different seasonal
        dam control schemes.  To show that the seasonal selection mechanism
        is implemented properly, we define a short simulation period of
        three days:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2001.01.01',
        ...                                    '2001.01.04',
        ...                                    '1d'))

        Now we prepare a dam model and define two different relationships
        between water level and flood discharge.  The first relatively
        simple relationship (for January, 2) is based on two neurons
        contained in a single hidden layer and is used in the following
        example.  The second neural network (for January, 3) is not
        applied at all, which is why we do not need to assign any parameter
        values to it:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> waterlevel2flooddischarge(
        ...     _01_02_12 = ann(nmb_inputs=1,
        ...                     nmb_neurons=(2,),
        ...                     nmb_outputs=1,
        ...                     weights_input=[[50., 4]],
        ...                     weights_output=[[2.], [30]],
        ...                     intercepts_hidden=[[-13000, -1046]],
        ...                     intercepts_output=[0.]),
        ...     _01_03_12 = ann(nmb_inputs=1,
        ...                     nmb_neurons=(2,),
        ...                     nmb_outputs=1))
        >>> derived.toy.update()
        >>> model.idx_sim = pub.timegrids.sim['2001.01.02']

        The following example shows two distinct effects of both neurons
        in the first network.  One neuron describes a relatively sharp
        increase between 259.8 and 260.2 meters from about 0 to 2 m³/s.
        This could describe a release of water through a bottom outlet
        controlled by a valve.  The add something like an exponential
        increase between 260 and 261 meters, which could describe the
        uncontrolled flow over a spillway:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.calc_flooddischarge_v1,
        ...                 last_example=21,
        ...                 parseqs=(aides.waterlevel,
        ...                          fluxes.flooddischarge))
        >>> test.nexts.waterlevel = numpy.arange(257, 261.1, 0.2)
        >>> test()
        | ex. | waterlevel | flooddischarge |
        -------------------------------------
        |   1 |      257.0 |            0.0 |
        |   2 |      257.2 |       0.000001 |
        |   3 |      257.4 |       0.000002 |
        |   4 |      257.6 |       0.000005 |
        |   5 |      257.8 |       0.000011 |
        |   6 |      258.0 |       0.000025 |
        |   7 |      258.2 |       0.000056 |
        |   8 |      258.4 |       0.000124 |
        |   9 |      258.6 |       0.000275 |
        |  10 |      258.8 |       0.000612 |
        |  11 |      259.0 |       0.001362 |
        |  12 |      259.2 |       0.003031 |
        |  13 |      259.4 |       0.006745 |
        |  14 |      259.6 |       0.015006 |
        |  15 |      259.8 |       0.033467 |
        |  16 |      260.0 |       1.074179 |
        |  17 |      260.2 |       2.164498 |
        |  18 |      260.4 |       2.363853 |
        |  19 |      260.6 |        2.79791 |
        |  20 |      260.8 |       3.719725 |
        |  21 |      261.0 |       5.576088 |
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    con.waterlevel2flooddischarge.inputs[0] = aid.waterlevel
    con.waterlevel2flooddischarge.process_actual_input(der.toy[self.idx_sim])
    flu.flooddischarge = con.waterlevel2flooddischarge.outputs[0]


def calc_outflow_v1(self):
    """Calculate the total outflow of the dam.

    Note that the maximum function is used to prevent from negative outflow
    values, which could otherwise occur within the required level of
    numerical accuracy.

    Required flux sequences:
      |ActualRelease|
      |FloodDischarge|

    Calculated flux sequence:
      |Outflow|

    Basic equation:
      :math:`Outflow = max(ActualRelease + FloodDischarge, 0.)`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> fluxes.actualrelease = 2.0
        >>> fluxes.flooddischarge = 3.0
        >>> model.calc_outflow_v1()
        >>> fluxes.outflow
        outflow(5.0)
        >>> fluxes.flooddischarge = -3.0
        >>> model.calc_outflow_v1()
        >>> fluxes.outflow
        outflow(0.0)
    """
    flu = self.sequences.fluxes.fastaccess
    flu.outflow = max(flu.actualrelease + flu.flooddischarge, 0.)


def update_watervolume_v1(self):
    """Update the actual water volume.

    Required derived parameter:
      |Seconds|

    Required flux sequences:
      |Inflow|
      |Outflow|

    Updated state sequence:
      |WaterVolume|

    Basic equation:
      :math:`\\frac{d}{dt}WaterVolume = 1e-6 \\cdot (Inflow-Outflow)`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.seconds = 2e6
        >>> states.watervolume.old = 5.0
        >>> fluxes.inflow = 2.0
        >>> fluxes.outflow = 3.0
        >>> model.update_watervolume_v1()
        >>> states.watervolume
        watervolume(3.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    new.watervolume = (old.watervolume +
                       der.seconds*(flu.inflow-flu.outflow)/1e6)


def update_watervolume_v2(self):
    """Update the actual water volume.

    Required derived parameter:
      |Seconds|

    Required flux sequences:
      |Inflow|
      |Outflow|
      |ActualRemoteRelease|

    Updated state sequence:
      |WaterVolume|

    Basic equation:
      :math:`\\frac{d}{dt}WaterVolume = 10^{-6}
      \\cdot (Inflow-Outflow-ActualRemoteRelease)`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.seconds = 2e6
        >>> states.watervolume.old = 5.0
        >>> fluxes.inflow = 2.0
        >>> fluxes.outflow = 3.0
        >>> fluxes.actualremoterelease = 1.0
        >>> model.update_watervolume_v2()
        >>> states.watervolume
        watervolume(1.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    new.watervolume = (
        old.watervolume +
        der.seconds*(flu.inflow-flu.outflow-flu.actualremoterelease)/1e6)


def update_watervolume_v3(self):
    """Update the actual water volume.

    Required derived parameter:
      |Seconds|

    Required flux sequences:
      |Inflow|
      |Outflow|
      |ActualRemoteRelease|
      |ActualRemoteRelieve|

    Updated state sequence:
      |WaterVolume|

    Basic equation:
      :math:`\\frac{d}{dt}WaterVolume = 10^{-6}
      \\cdot (Inflow-Outflow-ActualRemoteRelease-ActualRemoteRelieve)`

    Example:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> derived.seconds = 2e6
        >>> states.watervolume.old = 5.0
        >>> fluxes.inflow = 2.0
        >>> fluxes.outflow = 3.0
        >>> fluxes.actualremoterelease = 1.0
        >>> fluxes.actualremoterelieve = 0.5
        >>> model.update_watervolume_v3()
        >>> states.watervolume
        watervolume(0.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    new.watervolume = (
        old.watervolume +
        der.seconds*(flu.inflow -
                     flu.outflow -
                     flu.actualremoterelease -
                     flu.actualremoterelieve)/1e6)


def pass_outflow_v1(self):
    """Update the outlet link sequence."""
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += flu.outflow


def pass_actualremoterelease_v1(self):
    """Update the outlet link sequence."""
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.s[0] += flu.actualremoterelease


def pass_actualremoterelieve_v1(self):
    """Update outlet link sequence."""
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.r[0] += flu.actualremoterelieve


def pass_missingremoterelease_v1(self):
    flu = self.sequences.fluxes.fastaccess
    sen = self.sequences.senders.fastaccess
    sen.d[0] += flu.missingremoterelease


def pass_allowedremoterelieve_v1(self):
    flu = self.sequences.fluxes.fastaccess
    sen = self.sequences.senders.fastaccess
    sen.r[0] += flu.allowedremoterelieve


def pass_requiredremotesupply_v1(self):
    flu = self.sequences.fluxes.fastaccess
    sen = self.sequences.senders.fastaccess
    sen.s[0] += flu.requiredremotesupply


def update_loggedoutflow_v1(self):
    """Log a new entry of discharge at a cross section far downstream.

    Required control parameter:
      |NmbLogEntries|

    Required flux sequence:
      |Outflow|

    Calculated flux sequence:
      |LoggedOutflow|

    Example:

        The following example shows that, with each new method call, the
        three memorized values are successively moved to the right and the
        respective new value is stored on the bare left position:

        >>> from hydpy.models.dam import *
        >>> parameterstep()
        >>> nmblogentries(3)
        >>> logs.loggedoutflow = 0.0
        >>> from hydpy import UnitTest
        >>> test = UnitTest(model, model.update_loggedoutflow_v1,
        ...                 last_example=4,
        ...                 parseqs=(fluxes.outflow,
        ...                          logs.loggedoutflow))
        >>> test.nexts.outflow = [1.0, 3.0, 2.0, 4.0]
        >>> del test.inits.loggedoutflow
        >>> test()
        | ex. | outflow |           loggedoutflow |
        -------------------------------------------
        |   1 |     1.0 | 1.0  0.0            0.0 |
        |   2 |     3.0 | 3.0  1.0            0.0 |
        |   3 |     2.0 | 2.0  3.0            1.0 |
        |   4 |     4.0 | 4.0  2.0            3.0 |
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for idx in range(con.nmblogentries-1, 0, -1):
        log.loggedoutflow[idx] = log.loggedoutflow[idx-1]
    log.loggedoutflow[0] = flu.outflow


class Model(modeltools.ModelELS):
    """Dam base model."""

    _INLET_METHODS = (pic_inflow_v1,
                      pic_inflow_v2,
                      calc_naturalremotedischarge_v1,
                      calc_remotedemand_v1,
                      calc_remotefailure_v1,
                      calc_requiredremoterelease_v1,
                      calc_requiredrelease_v1,
                      calc_requiredrelease_v2,
                      calc_targetedrelease_v1)
    _RECEIVER_METHODS = (pic_totalremotedischarge_v1,
                         update_loggedtotalremotedischarge_v1,
                         pic_loggedrequiredremoterelease_v1,
                         pic_loggedrequiredremoterelease_v2,
                         calc_requiredremoterelease_v2,
                         pic_loggedallowedremoterelieve_v1,
                         calc_allowedremoterelieve_v1)
    _PART_ODE_METHODS = (pic_inflow_v1,
                         calc_waterlevel_v1,
                         calc_actualrelease_v1,
                         calc_possibleremoterelieve_v1,
                         calc_actualremoterelieve_v1,
                         calc_actualremoterelease_v1,
                         update_actualremoterelieve_v1,
                         update_actualremoterelease_v1,
                         calc_flooddischarge_v1,
                         calc_outflow_v1)
    _FULL_ODE_METHODS = (update_watervolume_v1,
                         update_watervolume_v2,
                         update_watervolume_v3)
    _OUTLET_METHODS = (pass_outflow_v1,
                       update_loggedoutflow_v1,
                       pass_actualremoterelease_v1,
                       pass_actualremoterelieve_v1)
    _SENDER_METHODS = (calc_missingremoterelease_v1,
                       pass_missingremoterelease_v1,
                       calc_allowedremoterelieve_v2,
                       pass_allowedremoterelieve_v1,
                       calc_requiredremotesupply_v1,
                       pass_requiredremotesupply_v1)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Discharge [m³/s]."""
    NDIM, NUMERIC = 0, False


class S(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water supply [m³/s]."""
    NDIM, NUMERIC = 0, False


class R(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water relieve [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of the dam model."""
    _SEQCLASSES = (Q,
                   S,
                   R)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_receivers.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Discharge [m³/s]."""
    NDIM, NUMERIC = 0, False


class D(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water demand [m³/s]."""
    NDIM, NUMERIC = 0, False


class S(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water supply [m³/s]."""
    NDIM, NUMERIC = 0, False


class R(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water relief [m³/s]."""
    NDIM, NUMERIC = 0, False


class ReceiverSequences(sequencetools.LinkSequences):
    """Information link sequences of the dam model."""
    _SEQCLASSES = (Q,
                   D,
                   S,
                   R)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_senders.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Discharge [m³/s]."""
    NDIM, NUMERIC = 0, False


class D(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water demand [m³/s]."""
    NDIM, NUMERIC = 0, False


class S(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water supply [m³/s]."""
    NDIM, NUMERIC = 0, False


class R(sequencetools.LinkSequence):   # pylint: disable=invalid-name
    """Water relief [m³/s]."""
    NDIM, NUMERIC = 0, False


class SenderSequences(sequencetools.LinkSequences):
    """Information link sequences of the dam model."""
    _SEQCLASSES = (Q,
                   D,
                   S,
                   R)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_solver.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class AbsErrorMax(parametertools.SolverParameter):
    """Absolute numerical error tolerance [m3/s].

    Note that the default initial value 0.01 refers to mm and the actual
    simulation step size. Hence the actual default initial value in m³/s is:

    :math:`AbsErrorMax = 0.01 \\cdot CatchmentArea \\cdot 1000 / Seconds`
    """
    NDIM = 0
    TYPE = float
    TIME = None
    SPAN = (0., None)
    INIT = 0.01

    def modify_init(self):
        pars = self.subpars.pars
        catchmentarea = pars.control.catchmentarea
        seconds = pars.derived.seconds
        return self.INIT*catchmentarea*1000./seconds


class RelDTMin(parametertools.SolverParameter):
    """Smallest relative integration time step size allowed [-]."""
    NDIM = 0
    TYPE = float
    TIME = None
    SPAN = (0.0, 1.0)
    INIT = 0.001


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of the Test model."""
    _PARCLASSES = (AbsErrorMax, RelDTMin)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/dam/dam_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
# pylint: enable=missing-docstring

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class WaterVolume(sequencetools.StateSequence):
    """Water volume [million m³]."""
    NDIM, NUMERIC, SPAN = 0, True, (None, None)


class StateSequences(sequencetools.StateSequences):
    """State sequences of the dam model."""
    _SEQCLASSES = (WaterVolume,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
# -*- coding: utf-8 -*-
"""The HydPy-H-Branch model allows for branching the input from a
single inlet |Node| instance to an arbitrary number of outlet |Node|
instances.  In the original HBV96 implementation, it is supposed to
separate inflowing discharge, but in :ref:`HydPy` it can be used for
arbitrary variables.  Calculations are performed for each branch
individually by linear interpolation (or extrapolation) in accordance
with tabulated supporting points.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from hbranch
from hydpy.models.hbranch.hbranch_control import ControlParameters
from hydpy.models.hbranch.hbranch_derived import DerivedParameters
from hydpy.models.hbranch.hbranch_fluxes import FluxSequences
from hydpy.models.hbranch.hbranch_inlets import InletSequences
from hydpy.models.hbranch.hbranch_outlets import OutletSequences
from hydpy.models.hbranch.hbranch_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy import pub
from hydpy.core import parametertools
from hydpy.core import devicetools
from hydpy.core import objecttools


class XPoints(parametertools.MultiParameter):
    """Supporting points for the independent input variable [eg. m³/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)

    def __call__(self, *args, **kwargs):
        self.shape = len(args)
        if self.shape[0] < 2:
            raise ValueError('Branching via linear interpolation requires '
                             'at least two supporting points, but for '
                             'parameter `%s` only %d are given.'
                             % (self.name, self.shape[0]))
        parametertools.MultiParameter.__call__(self, *args, **kwargs)
        if min(numpy.diff(self)) <= 0.:
            raise ValueError('The values of parameter `xpoints` must be '
                             'arranged in a strictly monotnously manner, '
                             'which is not the case for the given values '
                             '`%s`.' % ', '.join(str(value) for value in self))


class YPoints(parametertools.MultiParameter):
    """Supporting points for the dependent output variables [eg. m³/s].


    The documentation on method |calc_outputs_v1| gives examples on how
    to set the values of |YPoints| properly.
    """
    NDIM, TYPE, TIME, SPAN = 2, float, None, (None, None)

    def __call__(self, *args, **kwargs):
        try:
            self.shape = (len(kwargs), self.subpars.xpoints.shape[0])
        except RuntimeError:
            raise RuntimeError('The shape of parameter `ypoints` depends on '
                               'the shape of parameter `xpoints`.  Make sure '
                               'parameter `xpoints` is defined first (and is '
                               'integrated into the hmodel as described in '
                               'the documentation).')
        branched = self.subpars.pars.model.sequences.outlets.branched
        try:
            branched.shape = self.shape[0]
        except RuntimeError:
            if branched.shape[0] != self.shape[0]:
                raise RuntimeError('The number of branches of the hbranch '
                                   'model should not be changed during run '
                                   'time.  If you really need to do this, '
                                   'first initialize a new `branched` '
                                   'sequence and connect it to the '
                                   'respective outlet nodes properly.')
        if self.shape[0] == 0:
            raise ValueError('No branches are defined.  Do this via keyword '
                             'arguments of the same name as the related '
                             'outlet node instances.')
        self.subpars.pars.model.sequences.fluxes.outputs.shape = self.shape[0]
        for (idx, key) in enumerate(sorted(kwargs)):
            value = kwargs[key]
            if ((key not in devicetools.Node.registered_names()) and
                    (pub.timegrids is not None)):
                raise ValueError('Node `%s` does not exist so far.  Hence it '
                                 'is not possible to branch to it.' % key)
            try:
                self[idx] = value
            except ValueError:
                if self.shape[1] != len(value):
                    raise ValueError('Each branch requires the same number of '
                                     'supporting points as given for '
                                     'parameter `xpoints`, which is %d.  But '
                                     'for branch `%s` %d are given.'
                                     % (self.shape[1], key, len(value)))
                else:
                    message = 'The affected keyword argument is `%s`' % key
                    objecttools.augment_excmessage(suffix=message)
            setattr(self, key, self[idx])
            self.subpars.pars.model.nodenames.append(key)

    def __repr__(self):
        lines = self.commentrepr()
        nodenames = self.subpars.pars.model.nodenames
        for (idx, values) in enumerate(self):
            line = '%s=%s,' % (nodenames[idx], repr(list(values)))
            if not idx:
                lines.append('ypoints('+line)
            else:
                lines.append('        '+line)
        lines[-1] = lines[-1][:-1]+')'
        return '\n'.join(lines)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of hbranch, directly defined by the user.

    Note that the number of supporting points handled parameter |XPoints|
    and |YPoints| must be identical.  First define the values of parameter
    |XPoints|, then the values  of parameter |YPoints|.
    """
    _PARCLASSES = (XPoints, YPoints)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class NmbBranches(parametertools.SingleParameter):
    """Number of branches [-]."""
    NDIM, TYPE, TIME, SPAN = 0, int, None, (1, None)

    def update(self):
        con = self.subpars.pars.control
        self(con.ypoints.shape[0])


class NmbPoints(parametertools.SingleParameter):
    """Number of supporting points for linear interpolation [-]."""
    NDIM, TYPE, TIME, SPAN = 0, int, None, (2, None)

    def update(self):
        con = self.subpars.pars.control
        self(con.ypoints.shape[1])


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of hbranch, indirectly defined by the user."""
    _PARCLASSES = (NmbBranches, NmbPoints)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Input(sequencetools.FluxSequence):
    """Total input [e.g. m³/s]."""
    NDIM, NUMERIC = 0, False


class Outputs(sequencetools.FluxSequence):
    """Branched outputs [e.g. m³/s]."""
    NDIM, NUMERIC = 1, False

    def __repr__(self):
        nodenames = self.subseqs.seqs.model.nodenames
        lines = []
        for (idx, value) in enumerate(self.values):
            line = '%s=%s,' % (nodenames[idx], repr(value))
            if not idx:
                lines.append('outputs('+line)
            else:
                lines.append('        '+line)
        lines[-1] = lines[-1][:-1]+')'
        return '\n'.join(lines)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of the hbranch model."""
    _SEQCLASSES = (Input, Outputs)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_inlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Total(sequencetools.LinkSequence):
    """Total input [e.g. m³/s]."""
    NDIM, NUMERIC = 0, False


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of the hbranch model."""
    _SEQCLASSES = (Total,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools
from hydpy.core import devicetools


def calc_outputs_v1(self):
    """Performs the actual interpolation or extrapolation.

    Required control parameters:
      |XPoints|
      |YPoints|

    Required derived parameter:
      |NmbPoints|
      |NmbBranches|

    Required flux sequence:
      |Input|

    Calculated flux sequence:
      |Outputs|

    Examples:

        As a simple example, assume a weir directing all discharge into
        `branch1` until the capacity limit of 2 m³/s is reached.  The
        discharge exceeding this threshold is directed into `branch2`:

        >>> from hydpy.models.hbranch import *
        >>> parameterstep()
        >>> xpoints(0., 2., 4.)
        >>> ypoints(branch1=[0., 2., 2.],
        ...         branch2=[0., 0., 2.])
        >>> model.parameters.update()

        Low discharge example (linear interpolation between the first two
        supporting point pairs):

        >>> fluxes.input = 1.
        >>> model.calc_outputs_v1()
        >>> fluxes.outputs
        outputs(branch1=1.0,
                branch2=0.0)

        Medium discharge example (linear interpolation between the second
        two supporting point pairs):

        >>> fluxes.input = 3.
        >>> model.calc_outputs_v1()
        >>> print(fluxes.outputs)
        outputs(branch1=2.0,
                branch2=1.0)

        High discharge example (linear extrapolation beyond the second two
        supporting point pairs):

        >>> fluxes.input = 5.
        >>> model.calc_outputs_v1()
        >>> fluxes.outputs
        outputs(branch1=2.0,
                branch2=3.0)

        Non-monotonous relationships and balance violations are allowed,
        e.g.:

        >>> xpoints(0., 2., 4., 6.)
        >>> ypoints(branch1=[0., 2., 0., 0.],
        ...         branch2=[0., 0., 2., 4.])
        >>> model.parameters.update()
        >>> fluxes.input = 7.
        >>> model.calc_outputs_v1()
        >>> fluxes.outputs
        outputs(branch1=0.0,
                branch2=5.0)

    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    # Search for the index of the two relevant x points...
    for pdx in range(1, der.nmbpoints):
        if con.xpoints[pdx] > flu.input:
            break
    # ...and use it for linear interpolation (or extrapolation).
    for bdx in range(der.nmbbranches):
        flu.outputs[bdx] = (
            (flu.input-con.xpoints[pdx-1]) *
            (con.ypoints[bdx, pdx]-con.ypoints[bdx, pdx-1]) /
            (con.xpoints[pdx]-con.xpoints[pdx-1]) +
            con.ypoints[bdx, pdx-1])


def pick_input_v1(self):
    """Updates |Input| based on |Total|."""
    flu = self.sequences.fluxes.fastaccess
    inl = self.sequences.inlets.fastaccess
    flu.input = inl.total[0]


def pass_outputs_v1(self):
    """Updates |Branched| based on |Outputs|."""
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    for bdx in range(der.nmbbranches):
        out.branched[bdx][0] += flu.outputs[bdx]


class Model(modeltools.Model):
    """The HydPy-H-Branch model.

    Additional attribute:
      * nodenames (|list|): Names of the outlet node names, the
        actual model shall be connected to.
    """
    _INLET_METHODS = (pick_input_v1,)
    _RUN_METHODS = (calc_outputs_v1,)
    _OUTLET_METHODS = (pass_outputs_v1,)

    def __init__(self):
        modeltools.Model.__init__(self)
        self.nodenames = []

    def connect(self):
        """Connect the |LinkSequence| instances handled by the actual model
        to the |NodeSequence| instances handled by one inlet node and
        multiple oulet nodes.

        The HydPy-H-Branch model passes multiple output values to different
        outlet nodes.  This requires additional information regarding the
        `direction` of each output value.  Therefore, node names are used
        as keywords.  Assume, the discharge value of `n1` shall be branched
        to `n1a` and `n1b` via element `e1`:

        >>> from hydpy import *
        >>> n1, n1a, n1b = Node('n1'), Node('n1a'), Node('n1b')
        >>> e1 = Element('e1', inlets=n1, outlets=[n1a, n1b])

        Then parameter |YPoints| relates different supporting points via
        its keyword arguments to the respective nodes:

        >>> from hydpy.models.hbranch import *
        >>> parameterstep()
        >>> xpoints(0., 3.)
        >>> ypoints(n1a=[0., 1.], n1b=[0., 2.])

        After doing some preparations which are normally handled by
        :ref:`HydPy` automatically ...

        >>> model.element = e1
        >>> model.parameters.update()
        >>> model.connect()

        ...you can see that an example discharge value handled by the
        |Node| instance `n1` is properly divided:

        >>> n1.sequences.sim = 6.
        >>> model.doit(0)
        >>> print(n1a.sequences.sim, n1b.sequences.sim)
        sim(2.0) sim(4.0)

        """
        nodes = self.element.inlets.slaves
        if len(nodes) == 1:
            double = nodes[0].get_double_via_exits()
            self.sequences.inlets.total.set_pointer(double)
        else:
            RuntimeError('The hbranch model must be connected to exactly one '
                         'inlet node, but its parent element `%s` references '
                         'currently %d inlet nodes.'
                         % (self.element.name, len(nodes)))
        for (idx, name) in enumerate(self.nodenames):
            try:
                outlet = getattr(self.element.outlets, name)
                double = outlet.get_double_via_entries()
            except KeyError:
                if name in devicetools.Node.registered_names():
                    RuntimeError('The hbranch model tried to connect to the '
                                 'outlet node `%s`, but its parent element '
                                 '`%s` does not reference this node as an '
                                 'outlet node.' % (name, self.element.name))
                else:
                    RuntimeError('The hbranch model tried to connect to an '
                                 'outlet node named `%s`, which is not '
                                 'initialized yet.' % name)
            self.sequences.outlets.branched.set_pointer(double, idx)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hbranch/hbranch_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Branched(sequencetools.LinkSequence):
    """Branched outputs [e.g. m³/s]."""
    NDIM, NUMERIC = 1, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of the hbranch model."""
    _SEQCLASSES = (Branched,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
# -*- coding: utf-8 -*-
"""
The H-Land model is the core of the HydPy implementation of the
the frequently applied HBV96 model.  It consists of some routines
for the preparation of meteorological input, and some process
routines related to interception, snow, soil moisture, upper
groundwater, lower groundwater (including lakes), and runoff
concentration.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from hland
from hydpy.models.hland.hland_constants import FIELD, FOREST, GLACIER, ILAKE
from hydpy.models.hland.hland_parameters import Parameters
from hydpy.models.hland.hland_control import ControlParameters
from hydpy.models.hland.hland_derived import DerivedParameters
from hydpy.models.hland.hland_inputs import InputSequences
from hydpy.models.hland.hland_fluxes import FluxSequences
from hydpy.models.hland.hland_states import StateSequences
from hydpy.models.hland.hland_logs import LogSequences
from hydpy.models.hland.hland_outlets import OutletSequences
from hydpy.models.hland.hland_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_constants.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
# -*- coding: utf-8 -*-
"""The HydPy-H-Land model (|hland|) allows for the subdivision of subbasins
into zones (hydrological response units).  Some processes, e.g. interception,
are calculated separately for each zone.  This is why some parameters (e.g.
the interception capacity |IcMax|) and some sequences (e.g. the actual
interception storage |Ic|) are 1-dimensional.  Each entry represents the
value of a different zone.

In contrasts to the original HBV96 model, the HydPy-H-Land model allows for
arbitrary definitions of zones.  Nevertheless, the original distinction
in accordance with four different zone types is still supported.  The
parameter |ZoneType| defines e.g. which entry of |IcMax| is related to
which zone type via integer values.  Note that for zones of type |FIELD|
and |FOREST| the same equations are applied. (Usually, larger |IcMax|
values and smaller |CFMax| are assigned to |FOREST| zones due to their
higher leaf area index and the associated decrease in solar radiation.)
On the contrary, zones of type |GLACIER| and |ILAKE| are partly connected
to different process equations.

For comprehensibility, this module introduces the relevant integer constants.
Through performing a wildcard import

>>> from hydpy.models.hland import *

these are available in your local namespace:

>>> FIELD, FOREST, GLACIER, ILAKE
(1, 2, 3, 4)
"""
from hydpy.core import parametertools

FIELD = parametertools.IntConstant(1)
"""Constant for the zone type `field`."""
FOREST = parametertools.IntConstant(2)
"""Constant for the zone type `forest`."""
GLACIER = parametertools.IntConstant(3)
"""Constant for the zone type `glacier`."""
ILAKE = parametertools.IntConstant(4)
"""Constant for the zone type `internal lake`."""

CONSTANTS = parametertools.Constants()
"""Dictionary containing all constants defined by HydPy-H-Land."""

# Make only the constants available on wildcard-imports.
__all__ = list(CONSTANTS.keys())

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools
# ...model specific
from hydpy.models.hland import hland_constants
from hydpy.models.hland import hland_parameters


class Area(parametertools.SingleParameter):
    """Subbasin area [km²]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (1e-10, None)


class NmbZones(parametertools.SingleParameter):
    """Number of zones (hydrological response units) in a subbasin [-].

    Note that |NmbZones| determines the length of most 1-dimensional
    HydPy-H-Land parameters and sequences.  This required that the value of
    the respective |NmbZones| instance is set before any of the values
    of these 1-dimensional parameters or sequences are set.  Changing the
    value of the |NmbZones| instance necessitates setting their values
    again.

    Examples:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(5)
        >>> icmax.shape
        (5,)
        >>> states.ic.shape
        (5,)
    """
    NDIM, TYPE, TIME, SPAN = 0, int, None, (1, None)

    def __call__(self, *args, **kwargs):
        """The prefered way to pass a value to |NmbZones| instances within
        parameter control files.  Sets the shape of most 1-dimensional
        parameter objects (except |UH|) and sequence objects (except |QUH|)
        additionally.
        """
        parametertools.SingleParameter.__call__(self, *args, **kwargs)
        for subpars in self.subpars.pars.model.parameters:
            for par in subpars:
                if (par.NDIM > 0) and (par.name != 'uh'):
                    par.shape = self.value
        for subseqs in self.subpars.pars.model.sequences:
            for seq in subseqs:
                if (seq.NDIM > 0) and (seq.name != 'quh'):
                    seq.shape = self.value


class ZoneType(hland_parameters.MultiParameter):
    """Type of each zone: 1 (FIELD), 2 (FOREST), 3 (GLACIER), or 4 (ILAKE).

    For increasing legibility, the HydPy-H-Land constants are used for string
    representions of |ZoneType| instances:

    >>> from hydpy.models.hland import *
    >>> parameterstep('1d')
    >>> nmbzones(8)
    >>> zonetype(FIELD, FOREST, GLACIER, ILAKE, ILAKE, GLACIER, FOREST, FIELD)
    >>> zonetype.values
    array([1, 2, 3, 4, 4, 3, 2, 1])
    >>> zonetype
    zonetype(FIELD, FOREST, GLACIER, ILAKE, ILAKE, GLACIER, FOREST, FIELD)
    """
    NDIM, TYPE, TIME, SPAN = 1, int, None, (1, 4)

    def compress_repr(self):
        """Returns a list which contains a string representation with zone
        types being defined by the constants `FIELD`, `FOREST`...
        """
        invmap = {value: key for key, value in
                  hland_constants.CONSTANTS.items()}
        return [', '.join(invmap.get(value, repr(value))
                          for value in self.values)]


class ZoneArea(hland_parameters.MultiParameter):
    """Zone area [km²]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class ZoneZ(hland_parameters.MultiParameter):
    """Zone elevation [100m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class ZRelT(parametertools.SingleParameter):
    """Subbasin-wide reference elevation level for temperature [100m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (None, None)


class ZRelP(parametertools.SingleParameter):
    """Subbasin-wide reference elevation level for precipitation [100m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (None, None)


class ZRelE(parametertools.SingleParameter):
    """Subbasin-wide reference elevation level for evaporation [100m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (None, None)


class PCorr(hland_parameters.MultiParameter):
    """General precipitation correction factor [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class PCAlt(hland_parameters.MultiParameter):
    """Elevation correction factor for precipitation [-1/100m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class RfCF(hland_parameters.MultiParameter):
    """Rainfall correction factor [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class SfCF(hland_parameters.MultiParameter):
    """Snowfall correction factor [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class TCAlt(hland_parameters.MultiParameter):
    """Elevation correction factor for temperature [-1°C/100m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class ECorr(hland_parameters.MultiParameterNoGlacier):
    """General evaporation correction factor [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class ECAlt(hland_parameters.MultiParameterNoGlacier):
    """Elevation correction factor for evaporation [-1/100m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class EPF(hland_parameters.MultiParameterNoGlacier):
    """Decrease in potential evaporation due to precipitation [T/mm]."""
    NDIM, TYPE, TIME, SPAN = 1, float, False, (0., None)


class ETF(hland_parameters.MultiParameterNoGlacier):
    """Temperature factor for evaporation [1/°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class ERed(hland_parameters.MultiParameterSoil):
    """Factor for restricting actual to potential evaporation [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class TTIce(hland_parameters.MultiParameterLake):
    """Temperature threshold for lake evaporation [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class IcMax(hland_parameters.MultiParameterSoil):
    """Maximum interception storage [mm]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class TT(hland_parameters.MultiParameter):
    """Temperature threshold for snow/rain [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class TTInt(hland_parameters.MultiParameter):
    """Temperature interval with a mixture of snow and rain [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class DTTM(hland_parameters.MultiParameterLand):
    """Difference between |TTM| and |TT| [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class CFMax(hland_parameters.MultiParameterLand):
    """Degree day factor for snow (on glaciers or not) [mm/°C/T]."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)


class GMelt(hland_parameters.MultiParameterGlacier):
    """Degree day factor for glacial ice [mm/°C/T]."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)


class CFR(hland_parameters.MultiParameterLand):
    """Refreezing factor for water stored within the snow layer [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class WHC(hland_parameters.MultiParameterLand):
    """Relative water holding capacity of the snow layer [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class FC(hland_parameters.MultiParameterSoil):
    """Maximum soil moisture content (field capacity) [mm]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class LP(hland_parameters.MultiParameterSoil):
    """Relative limit for potential evaporation [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class Beta(hland_parameters.MultiParameterSoil):
    """Nonlinearity parameter of the soil routine [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class CFlux(hland_parameters.MultiParameterSoil):
    """Capacity (maximum) of the capillary return flux [mm/T]."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)


class RespArea(parametertools.SingleParameter):
    """Flag to enable the contributing area approach [-]."""
    NDIM, TYPE, TIME, SPAN = 0, bool, None, (0., None)


class RecStep(parametertools.SingleParameter):
    """Number of internal computation steps per simulation time step [-]."""
    NDIM, TYPE, TIME, SPAN = 0, int, True, (1, None)

    def __call__(self, *args, **kwargs):
        parametertools.SingleParameter.__call__(self, *args, **kwargs)
        self.value = int(round(self.value))


class PercMax(parametertools.SingleParameter):
    """Maximum percolation rate [mm/T]."""
    NDIM, TYPE, TIME, SPAN = 0, float, True, (0., None)


class K(parametertools.SingleParameter):
    """Recession coefficient of the upper zone layer [1/T/mm^alpha].

    In addition to the |SingleParameter| call method, it is possible to
    set the value of parameter |K| in accordance to the keyword arguments
    `khq`, `hq` and (optionally) `alpha`.  If `alpha` is not given, the
    value of the respective |Alpha| instance is taken.  This requires the
    |Alpha| instance to be initialized beforehand.

    Basic Equation:
        :math:`K = \\frac{HQ}{(HQ/KHQ)^{1+Alpha}}`

    Examples:

        When directly setting the value of parameter k, one only needs to be
        aware of its time dependence:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> k(2.)
        >>> k
        k(2.0)
        >>> k.value
        1.0

        Alternatively, one can specify the following three keyword
        arguments directly,...


        >>> k(hq=10., khq=2., alpha=1.)
        >>> k
        k(0.4)
        >>> k.value
        0.2

        ...or define the value of parameter alpha beforehand:

        >>> alpha(2.)
        >>> k(hq=10., khq=2.)
        >>> k
        k(0.08)
        >>> k.value
        0.04

    """
    NDIM, TYPE, TIME, SPAN = 0, float, True, (0., None)

    def __call__(self, *args, **kwargs):
        try:
            parametertools.SingleParameter.__call__(self, *args, **kwargs)
        except NotImplementedError:
            counter = ('khq' in kwargs) + ('hq' in kwargs)
            if counter == 0:
                raise ValueError('For parameter `k` a value can be set '
                                 'directly or indirectly by using the '
                                 'keyword arguments `khq` and `hq`.')
            elif counter == 1:
                raise ValueError('For the alternative calculation of '
                                 'parameter `k`, at least the keywords '
                                 'arguments `khq` and `hq` must be given.')
            elif counter == 2:
                try:
                    alpha = float(kwargs['alpha'])
                except KeyError:
                    try:
                        alpha = self.subpars.alpha.value
                    except (AttributeError, RuntimeError):
                        raise RuntimeError('For the alternative calculation '
                                           'of parameter `k`, either the '
                                           'keyword argument `alpha` must be '
                                           'given or the value of parameter '
                                           '`alpha` must be defined '
                                           'beforehand.')
                khq = float(kwargs['khq'])
                hq = float(kwargs['hq'])
                self(hq/((hq/khq)**(alpha+1.)))


class Alpha(parametertools.SingleParameter):
    """Nonlinearity parameter of the upper zone layer [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class K4(parametertools.SingleParameter):
    """Recession coefficient of the lower zone layer [1/T]."""
    NDIM, TYPE, TIME, SPAN = 0, float, True, (0., None)


class Gamma(parametertools.SingleParameter):
    """Nonlinearity parameter of the lower zone layer [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class MaxBaz(parametertools.SingleParameter):
    """Base length of the triangle unit hydrograph [T]."""
    NDIM, TYPE, TIME, SPAN = 0, float, False, (0., None)


class Abstr(parametertools.SingleParameter):
    """Abstraction of water from computed outflow [mm/T]."""
    NDIM, TYPE, TIME, SPAN = 0, float, True, (None, None)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-H-Land, directly defined by the user."""
    _PARCLASSES = (Area, NmbZones, ZoneType, ZoneArea, ZoneZ, ZRelP, ZRelT,
                   ZRelE, PCorr, PCAlt, RfCF, SfCF, TCAlt, ECorr, ECAlt, EPF,
                   ETF, ERed, TTIce, IcMax, TT, TTInt, DTTM, CFMax, GMelt, CFR,
                   WHC, FC, LP, Beta, PercMax, CFlux, RespArea, RecStep, Alpha,
                   K, K4, Gamma, MaxBaz, Abstr)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools
# ...model specific
from hydpy.models.hland import hland_parameters


class RelZoneArea(hland_parameters.MultiParameter):
    """Relative zone area [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class RelSoilArea(parametertools.SingleParameter):
    """Total area of all `field` and `forest` zones [km²]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., 1.)


class RelSoilZoneArea(hland_parameters.MultiParameter):
    """Relative zone area of all `field` and `forest` zones [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class RelLandZoneArea(hland_parameters.MultiParameter):
    """Relative Zone area of all `field`, `forest` and `glacier` zones [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class RelLandArea(parametertools.SingleParameter):
    """Quotient of the sum of |ZoneArea| and |Area| for zones that
    are not of type |ILAKE| [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., 1.)


class TTM(hland_parameters.MultiParameterLand):
    """Threshold temperature for snow melting and refreezing [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class DT(parametertools.SingleParameter):
    """Relative time step length for the upper zone layer calculations [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., 1.)


class NmbUH(parametertools.SingleParameter):
    """Number of the required unit hydrograph ordinates [-]."""
    NDIM, TYPE, TIME, SPAN = 0, int, None, (0, None)


class UH(parametertools.MultiParameter):
    """Unit hydrograph ordinates [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class QFactor(parametertools.SingleParameter):
    """Factor for converting mm/stepsize to m³/s."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-H-Land, indirectly defined by the user."""
    _PARCLASSES = (RelZoneArea, RelSoilArea, RelSoilZoneArea, RelLandZoneArea,
                   RelLandArea, TTM, DT, NmbUH, UH, QFactor)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class TMean(sequencetools.FluxSequence):
    """Mean subbasin temperature [°C]."""
    NDIM, NUMERIC = 0, False


class TC(sequencetools.FluxSequence):
    """Corrected temperature [°C]."""
    NDIM, NUMERIC = 1, False


class FracRain(sequencetools.FluxSequence):
    """Fraction rainfall / total precipitation [-]."""
    NDIM, NUMERIC = 1, False


class RfC(sequencetools.FluxSequence):
    """Actual precipitation correction related to liquid precipitation [-]."""
    NDIM, NUMERIC = 1, False


class SfC(sequencetools.FluxSequence):
    """Actual precipitation correction related to frozen precipitation [-]."""
    NDIM, NUMERIC = 1, False


class PC(sequencetools.FluxSequence):
    """Corrected precipitation [mm]."""
    NDIM, NUMERIC = 1, False


class EP(sequencetools.FluxSequence):
    """Potential evaporation [mm]."""
    NDIM, NUMERIC = 1, False


class EPC(sequencetools.FluxSequence):
    """Corrected potential evaporation [mm]."""
    NDIM, NUMERIC = 1, False


class EI(sequencetools.FluxSequence):
    """Interception evaporation [mm]."""
    NDIM, NUMERIC = 1, False


class TF(sequencetools.FluxSequence):
    """Throughfall [mm]."""
    NDIM, NUMERIC = 1, False


class GlMelt(sequencetools.FluxSequence):
    """Glacier melt [mm]."""
    NDIM, NUMERIC = 1, False


class Melt(sequencetools.FluxSequence):
    """Actual melting of frozen water stored in the snow layer [mm]."""
    NDIM, NUMERIC = 1, False


class Refr(sequencetools.FluxSequence):
    """Actual (re)freezing of liquid water stored in the snow layer [mm]."""
    NDIM, NUMERIC = 1, False


class In_(sequencetools.FluxSequence):
    """Snow module release/soil module inflow [mm]."""
    NDIM, NUMERIC = 1, False


class R(sequencetools.FluxSequence):
    """Effective soil response [mm]."""
    NDIM, NUMERIC = 1, False


class EA(sequencetools.FluxSequence):
    """Actual soil evaporation [mm]."""
    NDIM, NUMERIC = 1, False


class CFPot(sequencetools.FluxSequence):
    """Potential capillary flow [mm]."""
    NDIM, NUMERIC = 1, False


class CF(sequencetools.FluxSequence):
    """Actual capillary flow [mm]."""
    NDIM, NUMERIC = 1, False


class ContriArea(sequencetools.FluxSequence):
    """Fraction of the `soil area` contributing to runoff generation [-]."""
    NDIM, NUMERIC = 0, False


class InUZ(sequencetools.FluxSequence):
    """Inflow to the upper zone layer [mm]."""
    NDIM, NUMERIC = 0, False


class Perc(sequencetools.FluxSequence):
    """Percolation from the upper to the lower zone layer [mm]."""
    NDIM, NUMERIC = 0, False


class Q0(sequencetools.FluxSequence):
    """Outflow from the upper zone layer [mm]."""
    NDIM, NUMERIC = 0, False


class EL(sequencetools.FluxSequence):
    """Actual lake evaporation [mm]."""
    NDIM, NUMERIC = 1, False


class Q1(sequencetools.FluxSequence):
    """Outflow from the lower zone layer [mm]."""
    NDIM, NUMERIC = 0, False


class InUH(sequencetools.FluxSequence):
    """Input of the triangle unit hydrograph  [m]."""
    NDIM, NUMERIC = 0, False


class OutUH(sequencetools.FluxSequence):
    """Output of the triangle unit hydrograph  [m]."""
    NDIM, NUMERIC = 0, False


class QT(sequencetools.FluxSequence):
    """Total model outflow [mm]."""
    NDIM, NUMERIC = 0, False


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of the HydPy-H-Land model."""
    _SEQCLASSES = (TMean, TC, FracRain, RfC, SfC, PC, EP, EPC, EI, TF,
                   GlMelt, Melt, Refr, In_, R, EA, CFPot, CF, Perc,
                   ContriArea, InUZ, Q0, EL, Q1, InUH, OutUH, QT)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_inputs.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class P(sequencetools.InputSequence):
    """Precipitation [mm]."""
    NDIM, NUMERIC = 0, False


class T(sequencetools.InputSequence):
    """Temperature [°C]."""
    NDIM, NUMERIC = 0, False


class TN(sequencetools.InputSequence):
    """Normal temperature [°C]."""
    NDIM, NUMERIC = 0, False


class EPN(sequencetools.InputSequence):
    """Normal potential evaporation [mm]."""
    NDIM, NUMERIC = 0, False


class InputSequences(sequencetools.InputSequences):
    """Input sequences of the hland model."""
    _SEQCLASSES = (P, T, TN, EPN)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_logs.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
import sys
import warnings
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import sequencetools


class QUH(sequencetools.LogSequence):
    """Whole outflow delayed by means of the unit hydrograph [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def __call__(self, *args):
        try:
            sequencetools.LogSequence.__call__(self, *args)
        except BaseException:
            message = sys.exc_info()[1]
            sequencetools.LogSequence.__call__(self, numpy.sum(args))
            warnings.warn('Note that, due to the following problem, the '
                          'unit-hydrograph of the affected HydPy-H-Land '
                          'model could be initialised with an summed '
                          'value only: %s' % message)
        # The last value must be zero, otherwise all results were biased:
        self.values[-1] = 0.


class LogSequences(sequencetools.LogSequences):
    """Log sequences of the hland model."""
    _SEQCLASSES = (QUH,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
1745  
1746  
1747  
1748  
1749  
1750  
1751  
1752  
1753  
1754  
1755  
1756  
1757  
1758  
1759  
1760  
1761  
1762  
1763  
1764  
1765  
1766  
1767  
1768  
1769  
1770  
1771  
1772  
1773  
1774  
1775  
1776  
1777  
1778  
1779  
1780  
1781  
1782  
1783  
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  
1792  
1793  
1794  
1795  
1796  
1797  
1798  
1799  
1800  
1801  
1802  
1803  
1804  
1805  
1806  
1807  
1808  
1809  
1810  
1811  
1812  
1813  
1814  
1815  
1816  
1817  
1818  
1819  
1820  
1821  
1822  
1823  
1824  
1825  
1826  
1827  
1828  
1829  
1830  
1831  
1832  
1833  
1834  
1835  
1836  
1837  
1838  
1839  
1840  
1841  
1842  
1843  
1844  
1845  
1846  
1847  
1848  
1849  
1850  
1851  
1852  
1853  
1854  
1855  
1856  
1857  
1858  
1859  
1860  
1861  
1862  
1863  
1864  
1865  
1866  
1867  
1868  
1869  
1870  
1871  
1872  
1873  
1874  
1875  
1876  
1877  
1878  
1879  
1880  
1881  
1882  
1883  
1884  
1885  
1886  
1887  
1888  
1889  
1890  
1891  
1892  
1893  
1894  
1895  
1896  
1897  
1898  
1899  
1900  
1901  
1902  
1903  
1904  
1905  
1906  
1907  
1908  
1909  
1910  
1911  
1912  
1913  
1914  
1915  
1916  
1917  
1918  
1919  
1920  
1921  
1922  
1923  
1924  
1925  
1926  
1927  
1928  
1929  
1930  
1931  
1932  
1933  
1934  
1935  
1936  
1937  
1938  
1939  
1940  
1941  
1942  
1943  
1944  
1945  
1946  
1947  
1948  
1949  
1950  
1951  
1952  
1953  
1954  
1955  
1956  
1957  
1958  
1959  
1960  
1961  
1962  
1963  
1964  
1965  
1966  
1967  
1968  
1969  
1970  
1971  
1972  
1973  
1974  
1975  
1976  
1977  
1978  
1979  
1980  
1981  
1982  
1983  
1984  
1985  
1986  
1987  
1988  
1989  
1990  
1991  
1992  
1993  
1994  
1995  
1996  
1997  
1998  
1999  
2000  
2001  
2002  
2003  
2004  
2005  
2006  
2007  
2008  
2009  
2010  
2011  
2012  
2013  
2014  
2015  
2016  
2017  
2018  
2019  
2020  
2021  
2022  
2023  
2024  
2025  
2026  
2027  
2028  
2029  
2030  
2031  
2032  
2033  
2034  
2035  
2036  
2037  
2038  
2039  
2040  
2041  
2042  
2043  
2044  
2045  
2046  
2047  
2048  
2049  
2050  
2051  
2052  
2053  
2054  
2055  
2056  
2057  
2058  
2059  
2060  
2061  
2062  
2063  
2064  
2065  
2066  
2067  
2068  
2069  
2070  
2071  
2072  
2073  
2074  
2075  
2076  
2077  
2078  
2079  
2080  
2081  
2082  
2083  
2084  
2085  
2086  
2087  
2088  
2089  
2090  
2091  
2092  
2093  
2094  
2095  
2096  
2097  
2098  
2099  
2100  
2101  
2102  
2103  
2104  
2105  
2106  
2107  
2108  
2109  
2110  
2111  
2112  
2113  
2114  
2115  
2116  
2117  
2118  
2119  
2120  
2121  
2122  
2123  
2124  
2125  
2126  
2127  
2128  
2129  
2130  
2131  
2132  
2133  
2134  
2135  
2136  
2137  
2138  
2139  
2140  
2141  
2142  
2143  
2144  
2145  
2146  
2147  
2148  
2149  
2150  
2151  
2152  
2153  
2154  
2155  
2156  
2157  
2158  
2159  
2160  
2161  
2162  
2163  
2164  
2165  
2166  
2167  
2168  
2169  
2170  
2171  
2172  
2173  
2174  
2175  
2176  
2177  
2178  
2179  
2180  
2181  
2182  
2183  
2184  
2185  
2186  
2187  
2188  
2189  
2190  
2191  
2192  
2193  
2194  
2195  
2196  
2197  
2198  
2199  
2200  
2201  
2202  
2203  
2204  
2205  
2206  
2207  
2208  
2209  
2210  
2211  
2212  
2213  
2214  
2215  
2216  
2217  
2218  
2219  
2220  
2221  
2222  
2223  
2224  
2225  
2226  
2227  
2228  
2229  
2230  
2231  
2232  
2233  
2234  
2235  
2236  
2237  
2238  
2239  
2240  
2241  
2242  
2243  
2244  
2245  
2246  
2247  
2248  
2249  
2250  
# -*- coding: utf-8 -*-

# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools
from hydpy.cythons import modelutils
# ...model specifc
from hydpy.models.hland.hland_constants import FIELD, FOREST, GLACIER, ILAKE


def calc_tc_v1(self):
    """Adjust the measured air temperature to the altitude of the
    individual zones.

    Required control parameters:
      |NmbZones|
      |TCAlt|
      |ZoneZ|
      |ZRelT|

    Required input sequence:
      |T|

    Calculated flux sequences:
      |TC|

    Basic equation:
      :math:`TC = T - TCAlt \\cdot (ZoneZ-ZRelT)`

    Examples:
        Prepare two zones, the first one lying at the reference
        height and the second one 200 meters above:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(2); zrelt(2.); zonez(2., 4.)

        Applying the usual temperature lapse rate of 0.6°C/100m does
        not affect the temperature of the first zone but reduces the
        temperature of the second zone by 1.2°C:

        >>> tcalt(.6)
        >>> inputs.t = 5.
        >>> model.calc_tc_v1()
        >>> fluxes.tc
        tc(5.0, 3.8)
    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nmbzones):
        flu.tc[k] = inp.t-con.tcalt[k]*(con.zonez[k]-con.zrelt)


def calc_tmean_v1(self):
    """Calculate the areal mean temperature of the subbasin.

    Required derived parameter:
      |RelZoneArea|

    Required flux sequence:
      |TC|

    Calculated flux sequences:
      |TMean|

    Examples:
        Prepare sized zones, the first one being twice as large
        as the second one:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(2)
        >>> derived.relzonearea(2./3., 1./3.)

        With temperature values of 5°C and 8°C  of the respective zones,
        the mean temperature is 6°C:

        >>> fluxes.tc = 5., 8.
        >>> model.calc_tmean_v1()
        >>> fluxes.tmean
        tmean(6.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.tmean = 0.
    for k in range(con.nmbzones):
        flu.tmean += der.relzonearea[k]*flu.tc[k]


def calc_fracrain_v1(self):
    """Determine the temperature-dependent fraction of (liquid) rainfall
    and (total) precipitation.

    Required control parameters:
      |NmbZones|
      |TT|,
      |TTInt|

    Required flux sequence:
      |TC|

    Calculated flux sequences:
      |FracRain|

    Basic equation:
      :math:`FracRain = \\frac{TC-(TT-\\frac{TTInt}{2})}{TTInt}`

    Restriction:
      :math:`0 \\leq FracRain \\leq 1`


    Examples:
        The threshold temperature of seven zones is 0°C and the corresponding
        temperature interval of mixed precipitation 2°C:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(7)
        >>> tt(0.)
        >>> ttint(2.)

        The fraction of rainfall is zero below -1°C, is one above 1°C and
        increases linearly in between:

        >>> fluxes.tc = -10., -1., -.5, 0., .5, 1., 10.
        >>> model.calc_fracrain_v1()
        >>> fluxes.fracrain
        fracrain(0.0, 0.0, 0.25, 0.5, 0.75, 1.0, 1.0)

        Note the special case of a zero temperature interval.  With a
        actual temperature being equal to the threshold temperature, the
        rainfall fraction is one:

        >>> ttint(0.)
        >>> model.calc_fracrain_v1()
        >>> fluxes.fracrain
        fracrain(0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nmbzones):
        if flu.tc[k] >= (con.tt[k]+con.ttint[k]/2.):
            flu.fracrain[k] = 1.
        elif flu.tc[k] <= (con.tt[k]-con.ttint[k]/2.):
            flu.fracrain[k] = 0.
        else:
            flu.fracrain[k] = ((flu.tc[k]-(con.tt[k]-con.ttint[k]/2.)) /
                               con.ttint[k])


def calc_rfc_sfc_v1(self):
    """Calculate the corrected fractions rainfall/snowfall and total
    precipitation.

    Required control parameters:
      |NmbZones|
      |RfCF|
      |SfCF|

    Calculated flux sequences:
      |RfC|
      |SfC|

    Basic equations:
      :math:`RfC = RfCF \\cdot FracRain` \n
      :math:`SfC = SfCF \\cdot (1 - FracRain)`

    Examples:
        Assume five zones with different temperatures and hence
        different fractions of rainfall and total precipitation:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(5)
        >>> fluxes.fracrain = 0., .25, .5, .75, 1.

        With no rainfall and no snowfall correction (implied by the
        respective factors being one), the corrected fraction related
        to rainfall is identical with the original fraction and the
        corrected fraction related to snowfall behaves opposite:

        >>> rfcf(1.)
        >>> sfcf(1.)
        >>> model.calc_rfc_sfc_v1()
        >>> fluxes.rfc
        rfc(0.0, 0.25, 0.5, 0.75, 1.0)
        >>> fluxes.sfc
        sfc(1.0, 0.75, 0.5, 0.25, 0.0)

        With a negative rainfall correction of 20% and a positive
        snowfall correction of 20 % the corrected fractions are:

        >>> rfcf(0.8)
        >>> sfcf(1.2)
        >>> model.calc_rfc_sfc_v1()
        >>> fluxes.rfc
        rfc(0.0, 0.2, 0.4, 0.6, 0.8)
        >>> fluxes.sfc
        sfc(1.2, 0.9, 0.6, 0.3, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nmbzones):
        flu.rfc[k] = flu.fracrain[k]*con.rfcf[k]
        flu.sfc[k] = (1.-flu.fracrain[k])*con.sfcf[k]


def calc_pc_v1(self):
    """Apply the precipitation correction factors and adjust precipitation
    to the altitude of the individual zones.

    Required control parameters:
      |NmbZones|
      |PCorr|
      |PCAlt|
      |ZoneZ|
      |ZRelP|

    Required input sequence:
      |P|

    Required flux sequences:
      |RfC|
      |SfC|

    Calculated flux sequences:
      |PC|

    Basic equation:
      :math:`PC = P \\cdot PCorr
      \\cdot (1+PCAlt \\cdot (ZoneZ-ZRelP))
      \\cdot (RfC + SfC)`

    Examples:

        Five zones are at an elevation of 200 m.  A precipitation value
        of 5 mm has been measured at a gauge at an elevation of 300 m:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(5)
        >>> zrelp(2.0)
        >>> zonez(3.0)
        >>> inputs.p = 5.0

        The first four zones illustrate the individual precipitation
        corrections due to the general precipitation correction factor
        (|PCorr|, first zone), the altitude correction factor (|PCAlt|,
        second zone), the rainfall related correction (|RfC|, third zone),
        and the snowfall related correction factor (|SfC|, fourth zone).
        The fifth zone illustrates the interaction between all corrections:

        >>> pcorr(1.3, 1.0, 1.0, 1.0, 1.3)
        >>> pcalt(0.0, 0.1, 0.0, 0.0, 0.1)
        >>> fluxes.rfc = 0.5, 0.5, 0.4, 0.5, 0.4
        >>> fluxes.sfc = 0.5, 0.5, 0.5, 0.7, 0.7
        >>> model.calc_pc_v1()
        >>> fluxes.pc
        pc(6.5, 5.5, 4.5, 6.0, 7.865)

        Usually, one would set zero or positive values for parameter |PCAlt|.
        But it is also allowed to set negative values, in order to reflect
        possible negative relationships between precipitation and altitude.
        To prevent from calculating negative precipitation when too large
        negative values are applied, a truncation is performed:

        >>> pcalt(-1.0)
        >>> model.calc_pc_v1()
        >>> fluxes.pc
        pc(0.0, 0.0, 0.0, 0.0, 0.0)

    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nmbzones):
        flu.pc[k] = inp.p*(1.+con.pcalt[k]*(con.zonez[k]-con.zrelp))
        if flu.pc[k] <= 0.:
            flu.pc[k] = 0.
        else:
            flu.pc[k] *= con.pcorr[k]*(flu.rfc[k]+flu.sfc[k])


def calc_ep_v1(self):
    """Adjust potential norm evaporation to the actual temperature.

    Required control parameters:
      |NmbZones|
      |ETF|

    Required input sequence:
      |EPN|
      |TN|

    Required flux sequence:
      |TMean|

    Calculated flux sequences:
      |EP|

    Basic equation:
      :math:`EP = EPN \\cdot (1 + ETF \\cdot (TMean - TN))`

    Restriction:
      :math:`0 \leq EP \leq 2 \\cdot EPN`


    Examples:
        Assume four zones with different values of the temperature
        related factor for the adjustment of evaporation (the
        negative value of the first zone is not meaningful, but used
        for illustration purporses):

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(4)
        >>> etf(-0.5, 0.0, 0.1, 0.5)
        >>> inputs.tn = 20.
        >>> inputs.epn = 2.

        With mean temperature equal to norm temperature, actual
        (uncorrected) evaporation is equal to norm evaporation:

        >>> fluxes.tmean = 20.
        >>> model.calc_ep_v1()
        >>> fluxes.ep
        ep(2.0, 2.0, 2.0, 2.0)

        With mean temperature 5°C higher than norm temperature, potential
        evaporation is increased by 1 mm for the third zone, which
        possesses a very common adjustment factor.  For the first zone,
        potential evaporation is 0 mm (which is the smallest value
        allowed), and for the fourth zone it is the double value of the
        norm evaporation (which is the largest value allowed):

        >>> fluxes.tmean  = 25.
        >>> model.calc_ep_v1()
        >>> fluxes.ep
        ep(0.0, 2.0, 3.0, 4.0)
    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nmbzones):
        flu.ep[k] = inp.epn*(1.+con.etf[k]*(flu.tmean-inp.tn))
        flu.ep[k] = min(max(flu.ep[k], 0.), 2.*inp.epn)


def calc_epc_v1(self):
    """Apply the evaporation correction factors and adjust evaporation
    to the altitude of the individual zones.

    Calculate the areal mean of (uncorrected) potential evaporation
    for the subbasin, adjust it to the individual zones in accordance
    with their heights and perform some corrections, among which one
    depends on the actual precipitation.

    Required control parameters:
      |NmbZones|
      |ECorr|
      |ECAlt|
      |ZoneZ|
      |ZRelE|
      |EPF|

    Required flux sequences:
      |EP|
      |PC|

    Calculated flux sequences:
      |EPC|

    Basic equation:
      :math:`EPC = EP \\cdot ECorr
      \\cdot (1+ECAlt \\cdot (ZoneZ-ZRelE))
      \\cdot exp(-EPF \\cdot PC)`


    Examples:

        Four zones are at an elevation of 200 m.  A (uncorrected)
        potential evaporation value of 2 mm and a (corrected) precipitation
        value of 5 mm have been determined for each zone beforehand:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nmbzones(4)
        >>> zrele(2.0)
        >>> zonez(3.0)
        >>> fluxes.ep = 2.0
        >>> fluxes.pc = 5.0

        The first three zones  illustrate the individual evaporation
        corrections due to the general evaporation correction factor
        (|ECorr|, first zone), the altitude correction factor (|ECAlt|,
        second zone), the precipitation related correction factor
        (|EPF|, third zone).  The fourth zone illustrates the interaction
        between all corrections:

        >>> ecorr(1.3, 1.0, 1.0, 1.3)
        >>> ecalt(0.0, 0.1, 0.0, 0.1)
        >>> epf(0.0, 0.0, -numpy.log(.7)/10., -numpy.log(.7)/10.)
        >>> model.calc_epc_v1()
        >>> fluxes.epc
        epc(2.6, 1.8, 1.4, 1.638)

        To prevent from calculating negative evaporation values when too
        large values for parameter |ECAlt| are set, a truncation is performed:

        >>> ecalt(2.0)
        >>> model.calc_epc_v1()
        >>> fluxes.epc
        epc(0.0, 0.0, 0.0, 0.0)

    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nmbzones):
        flu.epc[k] = (flu.ep[k]*con.ecorr[k] *
                      (1. - con.ecalt[k]*(con.zonez[k]-con.zrele)))
        if flu.epc[k] <= 0.:
            flu.epc[k] = 0.
        else:
            flu.epc[k] *= modelutils.exp(-con.epf[k]*flu.pc[k])


def calc_tf_ic_v1(self):
    """Calculate throughfall and update the interception storage
    accordingly.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |IcMax|

    Required flux sequences:
      |PC|

    Calculated fluxes sequences:
      |TF|

    Updated state sequence:
      |Ic|

    Basic equation:
      :math:`TF = \\Bigl \\lbrace
      {
      {PC \\ | \\ Ic = IcMax}
      \\atop
      {0 \\ | \\ Ic < IcMax}
      }`

    Examples:
        Initialize six zones of different types.  Assume a
        generall maximum interception capacity of 2 mm. All zones receive
        a 0.5 mm input of precipitation:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(6)
        >>> zonetype(GLACIER, ILAKE, FIELD, FOREST, FIELD, FIELD)
        >>> icmax(2.)
        >>> fluxes.pc = .5
        >>> states.ic = 0., 0., 0., 0., 1., 2.
        >>> model.calc_tf_ic_v1()

        For glaciers (first zone) and internal lakes (second zone) the
        interception routine does not apply.  Hence, all precipitation is
        routed as throughfall. For fields and forests, the interception
        routine is identical (usually, only larger capacities for forests
        are assumed, due to their higher leaf area index).  Hence, the
        results of the third and the second zone are equal.  The last
        three zones demonstrate, that all precipitation is stored until
        the interception capacity is reached; afterwards, all precepitation
        is routed as throughfall.  Initial storage reduces the effective
        capacity of the respective simulation step:

        >>> states.ic
        ic(0.0, 0.0, 0.5, 0.5, 1.5, 2.0)
        >>> fluxes.tf
        tf(0.5, 0.5, 0.0, 0.0, 0.0, 0.5)

        A zero precipitation example:

        >>> fluxes.pc = 0.
        >>> states.ic = 0., 0., 0., 0., 1., 2.
        >>> model.calc_tf_ic_v1()
        >>> states.ic
        ic(0.0, 0.0, 0.0, 0.0, 1.0, 2.0)
        >>> fluxes.tf
        tf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

        A high precipitation example:

        >>> fluxes.pc = 5.
        >>> states.ic = 0., 0., 0., 0., 1., 2.
        >>> model.calc_tf_ic_v1()
        >>> states.ic
        ic(0.0, 0.0, 2.0, 2.0, 2.0, 2.0)
        >>> fluxes.tf
        tf(5.0, 5.0, 3.0, 3.0, 4.0, 5.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if (con.zonetype[k] == FIELD) or (con.zonetype[k] == FOREST):
            flu.tf[k] = max(flu.pc[k]-(con.icmax[k]-sta.ic[k]), 0.)
            sta.ic[k] += flu.pc[k]-flu.tf[k]
        else:
            flu.tf[k] = flu.pc[k]
            sta.ic[k] = 0.


def calc_ei_ic_v1(self):
    """Calculate interception evaporation and update the interception
    storage accordingly.

    Required control parameters:
      |NmbZones|
      |ZoneType|

    Required flux sequences:
      |EPC|

    Calculated fluxes sequences:
      |EI|

    Updated state sequence:
      |Ic|

    Basic equation:
      :math:`EI = \\Bigl \\lbrace
      {
      {EPC \\ | \\ Ic > 0}
      \\atop
      {0 \\ | \\ Ic = 0}
      }`

    Examples:
        Initialize six zones of different types.  For all zones
        a (corrected) potential evaporation of 0.5 mm is given:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(6)
        >>> zonetype(GLACIER, ILAKE, FIELD, FOREST, FIELD, FIELD)
        >>> fluxes.epc = .5
        >>> states.ic = 0., 0., 0., 0., 1., 2.
        >>> model.calc_ei_ic_v1()

        For glaciers (first zone) and internal lakes (second zone) the
        interception routine does not apply.  Hence, no interception
        evaporation can occur.  For fields and forests, the interception
        routine is identical (usually, only larger capacities for forests
        are assumed, due to their higher leaf area index).  Hence, the
        results of the third and the second zone are equal.  The last
        three zones demonstrate, that all interception evaporation is equal
        to potential evaporation until the interception storage is empty;
        afterwards, interception evaporation is zero:

        >>> states.ic
        ic(0.0, 0.0, 0.0, 0.0, 0.5, 1.5)
        >>> fluxes.ei
        ei(0.0, 0.0, 0.0, 0.0, 0.5, 0.5)

        A zero evaporation example:

        >>> fluxes.epc = 0.
        >>> states.ic = 0., 0., 0., 0., 1., 2.
        >>> model.calc_ei_ic_v1()
        >>> states.ic
        ic(0.0, 0.0, 0.0, 0.0, 1.0, 2.0)
        >>> fluxes.ei
        ei(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

        A high evaporation example:

        >>> fluxes.epc = 5.
        >>> states.ic = 0., 0., 0., 0., 1., 2.
        >>> model.calc_ei_ic_v1()
        >>> states.ic
        ic(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> fluxes.ei
        ei(0.0, 0.0, 0.0, 0.0, 1.0, 2.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if (con.zonetype[k] == FIELD) or (con.zonetype[k] == FOREST):
            flu.ei[k] = min(flu.epc[k], sta.ic[k])
            sta.ic[k] -= flu.ei[k]
        else:
            flu.ei[k] = 0.
            sta.ic[k] = 0.


def calc_sp_wc_v1(self):
    """Add throughfall to the snow layer.

    Required control parameters:
      |NmbZones|
      |ZoneType|

    Required flux sequences:
      |TF|
      |RfC|
      |SfC|

    Updated state sequences:
      |WC|
      |SP|

    Basic equations:
      :math:`\\frac{dSP}{dt} = TF \\cdot \\frac{SfC}{SfC+RfC}` \n
      :math:`\\frac{dWC}{dt} = TF \\cdot \\frac{RfC}{SfC+RfC}`

    Exemples:
        Consider the following setting, in which eight zones of
        different type receive a throughfall of 10mm:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(8)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD, FIELD, FIELD)
        >>> fluxes.tf = 10.
        >>> fluxes.sfc = .5, .5, .5, .5, .2, .8, 1., 4.
        >>> fluxes.rfc = .5, .5, .5, .5, .8, .2, 4., 1.
        >>> states.sp = 0.
        >>> states.wc = 0.
        >>> model.calc_sp_wc_v1()
        >>> states.sp
        sp(0.0, 5.0, 5.0, 5.0, 2.0, 8.0, 2.0, 8.0)
        >>> states.wc
        wc(0.0, 5.0, 5.0, 5.0, 8.0, 2.0, 8.0, 2.0)

        The snow routine does not apply for internal lakes, which is why
        both  the ice storage and the water storage of the first zone
        remain unchanged.  The snow routine is identical for glaciers,
        fields and forests in the current context, which is why the
        results of the second, third, and fourth zone are equal.  The
        last four zones illustrate that the corrected snowfall fraction
        as well as the corrected rainfall fraction are applied in a
        relative manner, as the total amount of water yield has been
        corrected in the interception module already.

        When both factors are zero, the neither the water nor the ice
        content of the snow layer changes:

        >>> fluxes.sfc = 0.
        >>> fluxes.rfc = 0.
        >>> states.sp = 2.
        >>> states.wc = 0.
        >>> model.calc_sp_wc_v1()
        >>> states.sp
        sp(0.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0)
        >>> states.wc
        wc(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if con.zonetype[k] != ILAKE:
            if (flu.rfc[k]+flu.sfc[k]) > 0.:
                sta.wc[k] += flu.tf[k]*flu.rfc[k]/(flu.rfc[k]+flu.sfc[k])
                sta.sp[k] += flu.tf[k]*flu.sfc[k]/(flu.rfc[k]+flu.sfc[k])
        else:
            sta.wc[k] = 0.
            sta.sp[k] = 0.


def calc_melt_sp_wc_v1(self):
    """Calculate melting of the ice content within the snow layer and
    update both the snow layers ice and the water content.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |CFMax|

    Required derived parameter:
      |TTM|

    Required flux sequences:
      |TC|

    Calculated fluxes sequences:
      |Melt|

    Required state sequence:
      |SP|

    Updatet state sequence:
        |WC|

    Basic equations:
      :math:`\\frac{dSP}{dt} = - Melt` \n
      :math:`\\frac{dWC}{dt} = + Melt` \n
      :math:`Melt = min(cfmax \\cdot (TC-TTM), SP)` \n

    Examples:
        Six zones are initialized with the same threshold
        temperature and degree day factor, but  with different zone types
        and initial ice contents:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nmbzones(6)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD)
        >>> cfmax(4.)
        >>> derived.ttm = 2.
        >>> states.sp = 0., 10., 10., 10., 5., 0.
        >>> states.wc = 2.

        Note that the assumed length of the simulation step is only a
        half day.  Hence the effective value of the degree day factor
        is not 4 but 2:

        >>> cfmax
        cfmax(4.0)
        >>> cfmax.values
        array([ 2.,  2.,  2.,  2.,  2.,  2.])

        When the actual temperature is equal to the threshold
        temperature for melting and refreezing, no melting  occurs
        and the states remain unchanged:

        >>> fluxes.tc = 2.
        >>> model.calc_melt_sp_wc_v1()
        >>> fluxes.melt
        melt(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sp
        sp(0.0, 10.0, 10.0, 10.0, 5.0, 0.0)
        >>> states.wc
        wc(0.0, 2.0, 2.0, 2.0, 2.0, 2.0)

        The same holds true for an actual temperature lower than the
        threshold temperature:

        >>> states.sp = 0., 10., 10., 10., 5., 0.
        >>> states.wc = 2.
        >>> fluxes.tc = -1.
        >>> model.calc_melt_sp_wc_v1()
        >>> fluxes.melt
        melt(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sp
        sp(0.0, 10.0, 10.0, 10.0, 5.0, 0.0)
        >>> states.wc
        wc(0.0, 2.0, 2.0, 2.0, 2.0, 2.0)

        With an actual temperature 3°C above the threshold temperature,
        melting can occur. Actual melting is consistent with potential
        melting, except for the first zone, which is an internal lake,
        and the last two zones, for which potential melting exceeds the
        available frozen water content of the snow layer:

        >>> states.sp = 0., 10., 10., 10., 5., 0.
        >>> states.wc = 2.
        >>> fluxes.tc = 5.
        >>> model.calc_melt_sp_wc_v1()
        >>> fluxes.melt
        melt(0.0, 6.0, 6.0, 6.0, 5.0, 0.0)
        >>> states.sp
        sp(0.0, 4.0, 4.0, 4.0, 0.0, 0.0)
        >>> states.wc
        wc(0.0, 8.0, 8.0, 8.0, 7.0, 2.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if con.zonetype[k] != ILAKE:
            if flu.tc[k] > der.ttm[k]:
                flu.melt[k] = min(con.cfmax[k] *
                                  (flu.tc[k]-der.ttm[k]), sta.sp[k])
                sta.sp[k] -= flu.melt[k]
                sta.wc[k] += flu.melt[k]
            else:
                flu.melt[k] = 0.
        else:
            flu.melt[k] = 0.
            sta.wc[k] = 0.
            sta.sp[k] = 0.


def calc_refr_sp_wc_v1(self):
    """Calculate refreezing of the water content within the snow layer and
    update both the snow layers ice and the water content.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |CFMax|
      |CFR|

    Required derived parameter:
      |TTM|

    Required flux sequences:
      |TC|

    Calculated fluxes sequences:
      |Refr|

    Required state sequence:
      |WC|

    Updated state sequence:
      |SP|

    Basic equations:
      :math:`\\frac{dSP}{dt} =  + Refr` \n
      :math:`\\frac{dWC}{dt} =  - Refr` \n
      :math:`Refr = min(cfr \\cdot cfmax \\cdot (TTM-TC), WC)`

    Examples:
        Six zones are initialized with the same threshold
        temperature, degree day factor and refreezing coefficient, but
        with different zone types and initial states:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nmbzones(6)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD)
        >>> cfmax(4.)
        >>> cfr(.1)
        >>> derived.ttm = 2.
        >>> states.sp = 2.
        >>> states.wc = 0., 1., 1., 1., .5, 0.

        Note that the assumed length of the simulation step is only
        a half day.  Hence the effective value of the degree day
        factor is not 4 but 2:

        >>> cfmax
        cfmax(4.0)
        >>> cfmax.values
        array([ 2.,  2.,  2.,  2.,  2.,  2.])

        When the actual temperature is equal to the threshold
        temperature for melting and refreezing, neither no refreezing
        occurs and the states remain unchanged:

        >>> fluxes.tc = 2.
        >>> model.calc_refr_sp_wc_v1()
        >>> fluxes.refr
        refr(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sp
        sp(0.0, 2.0, 2.0, 2.0, 2.0, 2.0)
        >>> states.wc
        wc(0.0, 1.0, 1.0, 1.0, 0.5, 0.0)

        The same holds true for an actual temperature higher than the
        threshold temperature:

        >>> states.sp = 2.
        >>> states.wc = 0., 1., 1., 1., .5, 0.
        >>> fluxes.tc = 2.
        >>> model.calc_refr_sp_wc_v1()
        >>> fluxes.refr
        refr(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sp
        sp(0.0, 2.0, 2.0, 2.0, 2.0, 2.0)
        >>> states.wc
        wc(0.0, 1.0, 1.0, 1.0, 0.5, 0.0)

        With an actual temperature 3°C above the threshold temperature,
        only melting can occur. Actual melting is consistent with
        potential melting, except for the first zone, which is an
        internal lake, and the last two zones, for which potential
        melting exceeds the available frozen water content of the
        snow layer:

        >>> states.sp = 2.
        >>> states.wc = 0., 1., 1., 1., .5, 0.
        >>> fluxes.tc = 5.
        >>> model.calc_refr_sp_wc_v1()
        >>> fluxes.refr
        refr(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sp
        sp(0.0, 2.0, 2.0, 2.0, 2.0, 2.0)
        >>> states.wc
        wc(0.0, 1.0, 1.0, 1.0, 0.5, 0.0)

        With an actual temperature 3°C below the threshold temperature,
        refreezing can occur. Actual refreezing is consistent with
        potential refreezing, except for the first zone, which is an
        internal lake, and the last two zones, for which potential
        refreezing exceeds the available liquid water content of the
        snow layer:

        >>> states.sp = 2.
        >>> states.wc = 0., 1., 1., 1., .5, 0.
        >>> fluxes.tc = -1.
        >>> model.calc_refr_sp_wc_v1()
        >>> fluxes.refr
        refr(0.0, 0.6, 0.6, 0.6, 0.5, 0.0)
        >>> states.sp
        sp(0.0, 2.6, 2.6, 2.6, 2.5, 2.0)
        >>> states.wc
        wc(0.0, 0.4, 0.4, 0.4, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if con.zonetype[k] != ILAKE:
            if flu.tc[k] < der.ttm[k]:
                flu.refr[k] = min(con.cfr[k]*con.cfmax[k] *
                                  (der.ttm[k]-flu.tc[k]), sta.wc[k])
                sta.sp[k] += flu.refr[k]
                sta.wc[k] -= flu.refr[k]
            else:
                flu.refr[k] = 0.

        else:
            flu.refr[k] = 0.
            sta.wc[k] = 0.
            sta.sp[k] = 0.


def calc_in_wc_v1(self):
    """Calculate the actual water release from the snow layer due to the
    exceedance of the snow layers capacity for (liquid) water.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |WHC|

    Required state sequence:
      |SP|

    Required flux sequence
      |TF|

    Calculated fluxes sequences:
      |In_|

    Updated state sequence:
      |WC|

    Basic equations:
      :math:`\\frac{dWC}{dt} = -In` \n
      :math:`-In = max(WC - WHC \\cdot SP, 0)`

    Examples:
        Initialize six zones of different types and frozen water
        contents of the snow layer and set the relative water holding
        capacity to 20% of the respective frozen water content:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(6)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD)
        >>> whc(.2)
        >>> states.sp = 0., 10., 10., 10., 5., 0.

        Also set the actual value of stand precipitation to 5 mm/d:

        >>> fluxes.tf = 5.

        When there is no (liquid) water content in the snow layer, no water
        can be released:

        >>> states.wc = 0.
        >>> model.calc_in_wc_v1()
        >>> fluxes.in_
        in_(5.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.wc
        wc(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

        When there is a (liquid) water content in the snow layer, the water
        release depends on the frozen water content.  Note the special
        cases of the first zone being an internal lake, for which the snow
        routine does not apply, and of the last zone, which has no ice
        content and thus effectively not really a snow layer:

        >>> states.wc = 5.
        >>> model.calc_in_wc_v1()
        >>> fluxes.in_
        in_(5.0, 3.0, 3.0, 3.0, 4.0, 5.0)
        >>> states.wc
        wc(0.0, 2.0, 2.0, 2.0, 1.0, 0.0)

        When the relative water holding capacity is assumed to be zero,
        all liquid water is released:

        >>> whc(0.)
        >>> states.wc = 5.
        >>> model.calc_in_wc_v1()
        >>> fluxes.in_
        in_(5.0, 5.0, 5.0, 5.0, 5.0, 5.0)
        >>> states.wc
        wc(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)

        Note that for the single lake zone, stand precipitation is
        directly passed to `in_` in all three examples.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if con.zonetype[k] != ILAKE:
            flu.in_[k] = max(sta.wc[k]-con.whc[k]*sta.sp[k], 0.)
            sta.wc[k] -= flu.in_[k]
        else:
            flu.in_[k] = flu.tf[k]
            sta.wc[k] = 0.


def calc_glmelt_in_v1(self):
    """Calculate melting from glaciers which are actually not covered by
    a snow layer and add it to the water release of the snow module.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |GMelt|

    Required state sequence:
      |SP|

    Required flux sequence:
      |TC|

    Calculated fluxes sequence:
      |GlMelt|

    Updated flux sequence:
      |In_|

    Basic equation:

      :math:`GlMelt = \\Bigl \\lbrace
      {
      {max(GMelt \\cdot (TC-TTM), 0) \\ | \\ SP = 0}
      \\atop
      {0 \\ | \\ SP > 0}
      }`


    Examples:
        Seven zones are prepared, but glacier melting occurs only
        in the fourth one, as the first three zones are no glaciers, the
        fifth zone is covered by a snow layer and the actual temperature
        of the last two zones is not above the threshold temperature:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nmbzones(7)
        >>> zonetype(FIELD, FOREST, ILAKE, GLACIER, GLACIER, GLACIER, GLACIER)
        >>> gmelt(4.)
        >>> derived.ttm(2.)
        >>> states.sp = 0., 0., 0., 0., .1, 0., 0.
        >>> fluxes.tc = 3., 3., 3., 3., 3., 2., 1.
        >>> fluxes.in_ = 3.
        >>> model.calc_glmelt_in_v1()
        >>> fluxes.glmelt
        glmelt(0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0)
        >>> fluxes.in_
        in_(3.0, 3.0, 3.0, 5.0, 3.0, 3.0, 3.0)

        Note that the assumed length of the simulation step is only
        a half day. Hence the effective value of the degree day factor
        is not 4 but 2:

        >>> gmelt
        gmelt(4.0)
        >>> gmelt.values
        array([ 2.,  2.,  2.,  2.,  2.,  2.,  2.])
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if ((con.zonetype[k] == GLACIER) and
                (sta.sp[k] <= 0.) and (flu.tc[k] > der.ttm[k])):
            flu.glmelt[k] = con.gmelt[k]*(flu.tc[k]-der.ttm[k])
            flu.in_[k] += flu.glmelt[k]
        else:
            flu.glmelt[k] = 0.


def calc_r_sm_v1(self):
    """Calculate effective precipitation and update soil moisture.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |FC|
      |Beta|

    Required fluxes sequence:
      |In_|

    Calculated flux sequence:
      |R|

    Updated state sequence:
      |SM|

    Basic equations:
      :math:`\\frac{dSM}{dt} = IN - R` \n
      :math:`R = IN \\cdot \\left(\\frac{SM}{FC}\\right)^{Beta}`


    Examples:
        Initialize six zones of different types.  The field
        capacity of all fields and forests is set to 200mm, the input
        of each zone is 10mm:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(6)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD)
        >>> fc(200.)
        >>> fluxes.in_ = 10.

        With a common nonlinearity parameter value of 2, a relative
        soil moisture of 50%  (zones three and four) results in a
        discharge coefficient of 25%. For a soil completely dried
        (zone five) or completely saturated (one six) the discharge
        coefficient does not depend on the nonlinearity parameter and
        is 0% and 100% respectively.  Glaciers and internal lakes also
        always route 100% of their input as effective precipitation:

        >>> beta(2.)
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> model.calc_r_sm_v1()
        >>> fluxes.r
        r(10.0, 10.0, 2.5, 2.5, 0.0, 10.0)
        >>> states.sm
        sm(0.0, 0.0, 107.5, 107.5, 10.0, 200.0)

        Through decreasing the nonlinearity parameter, the discharge
        coefficient increases.  A parameter value of zero leads to a
        discharge coefficient of 100% for any soil moisture:

        >>> beta(0.)
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> model.calc_r_sm_v1()
        >>> fluxes.r
        r(10.0, 10.0, 10.0, 10.0, 10.0, 10.0)
        >>> states.sm
        sm(0.0, 0.0, 100.0, 100.0, 0.0, 200.0)

        With zero field capacity, the discharge coefficient also always
        equates to 100%:

        >>> fc(0.)
        >>> beta(2.)
        >>> states.sm = 0.
        >>> model.calc_r_sm_v1()
        >>> fluxes.r
        r(10.0, 10.0, 10.0, 10.0, 10.0, 10.0)
        >>> states.sm
        sm(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if (con.zonetype[k] == FIELD) or (con.zonetype[k] == FOREST):
            if con.fc[k] > 0.:
                flu.r[k] = flu.in_[k]*(sta.sm[k]/con.fc[k])**con.beta[k]
                flu.r[k] = max(flu.r[k], sta.sm[k]+flu.in_[k]-con.fc[k])
            else:
                flu.r[k] = flu.in_[k]
            sta.sm[k] += flu.in_[k]-flu.r[k]
        else:
            flu.r[k] = flu.in_[k]
            sta.sm[k] = 0.


def calc_cf_sm_v1(self):
    """Calculate capillary flow and update soil moisture.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |FC|
      |CFlux|

    Required fluxes sequence:
      |R|

    Required state sequence:
      |UZ|

    Calculated flux sequence:
      |CF|

    Updated state sequence:
      |SM|

    Basic equations:
      :math:`\\frac{dSM}{dt} = CF` \n
      :math:`CF = CFLUX \\cdot (1 - \\frac{SM}{FC})`

    Examples:
        Initialize six zones of different types.  The field
        capacity of als fields and forests is set to 200mm, the maximum
        capillary flow rate is 4mm/d:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nmbzones(6)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD)
        >>> fc(200.)
        >>> cflux(4.)

        Note that the assumed length of the simulation step is only
        a half day.  Hence the maximum capillary flow per simulation
        step is 2 instead of 4:

        >>> cflux
        cflux(4.0)
        >>> cflux.values
        array([ 2.,  2.,  2.,  2.,  2.,  2.])

        For fields and forests, the actual capillary return flow depends
        on the relative soil moisture deficite, if either the upper zone
        layer provides enough water...

        >>> fluxes.r = 0.
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> states.uz = 20.
        >>> model.calc_cf_sm_v1()
        >>> fluxes.cf
        cf(0.0, 0.0, 1.0, 1.0, 2.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 101.0, 101.0, 2.0, 200.0)

        ...our enough effective precipitation is generated, which can be
        rerouted directly:

        >>> cflux(4.)
        >>> fluxes.r = 10.
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> states.uz = 0.
        >>> model.calc_cf_sm_v1()
        >>> fluxes.cf
        cf(0.0, 0.0, 1.0, 1.0, 2.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 101.0, 101.0, 2.0, 200.0)

        If the upper zone layer is empty and no effective precipitation is
        generated, capillary flow is zero:

        >>> cflux(4.)
        >>> fluxes.r = 0.
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> states.uz = 0.
        >>> model.calc_cf_sm_v1()
        >>> fluxes.cf
        cf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 100.0, 100.0, 0.0, 200.0)

        Here an example, where both the upper zone layer and effective
        precipitation provide water for the capillary flow, but less then
        the maximum flow rate times the relative soil moisture:

        >>> cflux(4.)
        >>> fluxes.r = 0.1
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> states.uz = 0.2
        >>> model.calc_cf_sm_v1()
        >>> fluxes.cf
        cf(0.0, 0.0, 0.3, 0.3, 0.3, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 100.3, 100.3, 0.3, 200.0)

        Even unrealistic high maximum capillary flow rates do not result
        in overfilled soils:

        >>> cflux(1000.)
        >>> fluxes.r = 200.
        >>> states.sm = 0., 0., 100., 100., 0., 200.
        >>> states.uz = 200.
        >>> model.calc_cf_sm_v1()
        >>> fluxes.cf
        cf(0.0, 0.0, 100.0, 100.0, 200.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 200.0, 200.0, 200.0, 200.0)

        For (unrealistic) soils with zero field capacity, capillary flow
        is always zero:

        >>> fc(0.)
        >>> states.sm = 0.
        >>> model.calc_cf_sm_v1()
        >>> fluxes.cf
        cf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if (con.zonetype[k] == FIELD) or (con.zonetype[k] == FOREST):
            if con.fc[k] > 0.:
                flu.cf[k] = con.cflux[k]*(1.-sta.sm[k]/con.fc[k])
                flu.cf[k] = min(flu.cf[k], sta.uz+flu.r[k])
                flu.cf[k] = min(flu.cf[k], con.fc[k]-sta.sm[k])
            else:
                flu.cf[k] = 0.
            sta.sm[k] += flu.cf[k]
        else:
            flu.cf[k] = 0.
            sta.sm[k] = 0.


def calc_ea_sm_v1(self):
    """Calculate soil evaporation and update soil moisture.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |FC|
      |LP|
      |ERed|

    Required fluxes sequences:
      |EPC|
      |EI|

    Required state sequence:
      |SP|

    Calculated flux sequence:
      |EA|

    Updated state sequence:
      |SM|

    Basic equations:
      :math:`\\frac{dSM}{dt} = - EA` \n
      :math:`EA_{temp} = \\biggl \\lbrace
      {
      {EPC \\cdot min\\left(\\frac{SM}{LP \\cdot FC}, 1\\right)
      \\ | \\ SP = 0}
      \\atop
      {0 \\ | \\ SP > 0}
      }` \n
      :math:`EA = EA_{temp} - max(ERED \\cdot (EA_{temp} + EI - EPC), 0)`

    Examples:
        Initialize seven zones of different types.  The field capacity
         of all fields and forests is set to 200mm, potential evaporation
         and interception evaporation are 2mm and 1mm respectively:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(7)
        >>> zonetype(ILAKE, GLACIER, FIELD, FOREST, FIELD, FIELD, FIELD)
        >>> fc(200.)
        >>> lp(.0, .0, .5, .5, .0, .8, 1.)
        >>> ered(0.)
        >>> fluxes.epc = 2.
        >>> fluxes.ei = 1.
        >>> states.sp = 0.

        Only fields and forests include soils; for glaciers and zones (the
        first two zones) no soil evaporation is performed.  For fields and
        forests, the underlying calculations are the same. In the following
        example, the relative soil moisture is 50% in all field and forest
        zones.  Hence, differences in soil evaporation are related to the
        different soil evaporation parameter values only:

        >>> states.sm = 100.
        >>> model.calc_ea_sm_v1()
        >>> fluxes.ea
        ea(0.0, 0.0, 2.0, 2.0, 2.0, 1.25, 1.0)
        >>> states.sm
        sm(0.0, 0.0, 98.0, 98.0, 98.0, 98.75, 99.0)

        In the last example, evaporation values of 2mm have been calculated
        for some zones despite the fact, that these 2mm added to the actual
        interception evaporation of 1mm exceed potential evaporation.  This
        behaviour can be reduced...

        >>> states.sm = 100.
        >>> ered(.5)
        >>> model.calc_ea_sm_v1()
        >>> fluxes.ea
        ea(0.0, 0.0, 1.5, 1.5, 1.5, 1.125, 1.0)
        >>> states.sm
        sm(0.0, 0.0, 98.5, 98.5, 98.5, 98.875, 99.0)

        ...or be completely excluded:

        >>> states.sm = 100.
        >>> ered(1.)
        >>> model.calc_ea_sm_v1()
        >>> fluxes.ea
        ea(0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0)
        >>> states.sm
        sm(0.0, 0.0, 99.0, 99.0, 99.0, 99.0, 99.0)

        Any occurrence of a snow layer suppresses soil evaporation
        completely:

        >>> states.sp = 0.01
        >>> states.sm = 100.
        >>> model.calc_ea_sm_v1()
        >>> fluxes.ea
        ea(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 100.0, 100.0, 100.0, 100.0, 100.0)

        For (unrealistic) soils with zero field capacity, soil evaporation
        is always zero:

        >>> fc(0.)
        >>> states.sm = 0.
        >>> model.calc_ea_sm_v1()
        >>> fluxes.ea
        ea(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        >>> states.sm
        sm(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if (con.zonetype[k] == FIELD) or (con.zonetype[k] == FOREST):
            if sta.sp[k] <= 0.:
                if (con.lp[k]*con.fc[k]) > 0.:
                    flu.ea[k] = flu.epc[k]*sta.sm[k]/(con.lp[k]*con.fc[k])
                    flu.ea[k] = min(flu.ea[k], flu.epc[k])
                else:
                    flu.ea[k] = flu.epc[k]
                flu.ea[k] -= max(con.ered[k] *
                                 (flu.ea[k]+flu.ei[k]-flu.epc[k]), 0.)
                flu.ea[k] = min(flu.ea[k], sta.sm[k])
            else:
                flu.ea[k] = 0.
            sta.sm[k] -= flu.ea[k]
        else:
            flu.ea[k] = 0.
            sta.sm[k] = 0.


def calc_inuz_v1(self):
    """Accumulate the total inflow into the upper zone layer.

    Required control parameters:
      |NmbZones|
      |ZoneType|

    Required derived parameters:
      |RelLandZoneArea|

    Required fluxes sequences:
      |R|
      |CF|

    Calculated flux sequence:
      |InUZ|

    Basic equation:
      :math:`InUZ = R - CF`

    Examples:
        Initialize three zones of different relative `land sizes`
        (area related to the total size of the subbasin except lake areas):

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(3)
        >>> zonetype(FIELD, ILAKE, GLACIER)
        >>> derived.rellandzonearea = 2./3., 0., 1./3.
        >>> fluxes.r = 6., 0., 2.
        >>> fluxes.cf = 2., 0., 1.
        >>> model.calc_inuz_v1()
        >>> fluxes.inuz
        inuz(3.0)

        Internal lakes do not contribute to the upper zone layer.  Hence
        for a subbasin consisting only of interal lakes a zero input
        value would be calculated:

        >>> zonetype(ILAKE, ILAKE, ILAKE)
        >>> model.calc_inuz_v1()
        >>> fluxes.inuz
        inuz(0.0)

    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.inuz = 0.
    for k in range(con.nmbzones):
        if con.zonetype[k] != ILAKE:
            flu.inuz += der.rellandzonearea[k]*(flu.r[k]-flu.cf[k])


def calc_contriarea_v1(self):
    """Determine the relative size of the contributing area of the whole
    subbasin.

    Required control parameters:
      |NmbZones|
      |ZoneType|
      |RespArea|
      |FC|
      |Beta|

    Required derived parameter:
    |RelSoilArea|

    Required state sequence:
      |SM|

    Calculated fluxes sequences:
      |ContriArea|

    Basic equation:
      :math:`ContriArea = \\left( \\frac{SM}{FC} \\right)^{Beta}`

    Examples:
        Four zones are initialized, but only the first two zones
        of type field and forest are taken into account in the calculation
        of the relative contributing area of the catchment (even, if also
        glaciers contribute to the inflow of the upper zone layer):

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(4)
        >>> zonetype(FIELD, FOREST, GLACIER, ILAKE)
        >>> beta(2.)
        >>> fc(200.)
        >>> resparea(True)
        >>> derived.relsoilarea(.5)
        >>> derived.relsoilzonearea(1./3., 2./3., 0., 0.)

        With a relative soil moisture of 100% in the whole subbasin, the
        contributing area is also estimated as 100%,...

        >>> states.sm = 200.
        >>> model.calc_contriarea_v1()
        >>> fluxes.contriarea
        contriarea(1.0)

        ...and relative soil moistures of 0% result in an contributing
        area of 0%:

        >>> states.sm = 0.
        >>> model.calc_contriarea_v1()
        >>> fluxes.contriarea
        contriarea(0.0)

        With the given value 2 of the nonlinearity parameter Beta, soil
        moisture of 50% results in a contributing area estimate of 25%:

        >>> states.sm = 100.
        >>> model.calc_contriarea_v1()
        >>> fluxes.contriarea
        contriarea(0.25)

        Setting the response area option to False,...

        >>> resparea(False)
        >>> model.calc_contriarea_v1()
        >>> fluxes.contriarea
        contriarea(1.0)

        ... setting the soil area (total area of all field and forest
        zones in the subbasin) to zero...,

        >>> resparea(True)
        >>> derived.relsoilarea(0.)
        >>> model.calc_contriarea_v1()
        >>> fluxes.contriarea
        contriarea(1.0)

        ...or setting all field capacities to zero...

        >>> derived.relsoilarea(.5)
        >>> fc(0.)
        >>> states.sm = 0.
        >>> model.calc_contriarea_v1()
        >>> fluxes.contriarea
        contriarea(1.0)

        ...leads to contributing area values of 100%.
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    if con.resparea and (der.relsoilarea > 0.):
        flu.contriarea = 0.
        for k in range(con.nmbzones):
            if (con.zonetype[k] == FIELD) or (con.zonetype[k] == FOREST):
                if con.fc[k] > 0.:
                    flu.contriarea += (der.relsoilzonearea[k] *
                                       (sta.sm[k]/con.fc[k])**con.beta[k])
                else:
                    flu.contriarea += der.relsoilzonearea[k]
    else:
        flu.contriarea = 1.


def calc_q0_perc_uz_v1(self):
    """Perform the upper zone layer routine which determines percolation
    to the lower zone layer and the fast response of the hland model.
    Note that the system behaviour of this method depends strongly on the
    specifications of the options |RespArea| and |RecStep|.

    Required control parameters:
      |RecStep|
      |PercMax|
      |K|
      |Alpha|

    Required derived parameters:
      |DT|

    Required fluxes sequence:
      |InUZ|

    Calculated fluxes sequences:
      |Perc|
      |Q0|

    Updated state sequence:
      |UZ|

    Basic equations:
      :math:`\\frac{dUZ}{dt} = InUZ - Perc - Q0` \n
      :math:`Perc = PercMax \\cdot ContriArea` \n
      :math:`Q0 = K * \\cdot \\left( \\frac{UZ}{ContriArea} \\right)^{1+Alpha}`

    Examples:
        The upper zone layer routine is an exception compared to
        the other routines of the HydPy-H-Land model, regarding its
        consideration of numerical accuracy.  To increase the accuracy of
        the numerical integration of the underlying ordinary differential
        equation, each simulation step can be divided into substeps, which
        are all solved with first order accuracy.  In the first example,
        this option is omitted through setting the RecStep parameter to one:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> recstep(2)
        >>> derived.dt = 1./recstep
        >>> percmax(2.)
        >>> alpha(1.)
        >>> k(2.)
        >>> fluxes.contriarea = 1.
        >>> fluxes.inuz = 0.
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(1.0)
        >>> fluxes.q0
        q0(0.0)
        >>> states.uz
        uz(0.0)

        Due to the sequential calculation of the upper zone routine, the
        upper zone storage is drained completely through percolation and
        no water is left for fast discharge response.  By dividing the
        simulation step in 100 substeps, the results are quite different:

        >>> recstep(200)
        >>> derived.dt = 1./recstep
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(0.786934)
        >>> fluxes.q0
        q0(0.213066)
        >>> states.uz
        uz(0.0)

        Note that the assumed length of the simulation step is only a
        half day. Hence the effective values of the maximum percolation
        rate and the storage coefficient is not 2 but 1:

        >>> percmax
        percmax(2.0)
        >>> k
        k(2.0)
        >>> percmax.value
        1.0
        >>> k.value
        1.0

        By decreasing the contributing area one decreases percolation but
        increases fast discharge response:

        >>> fluxes.contriarea = .5
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(0.434108)
        >>> fluxes.q0
        q0(0.565892)
        >>> states.uz
        uz(0.0)

        Resetting RecStep leads to more transparent results.  Note that, due
        to the large value of the storage coefficient and the low accuracy
        of the numerical approximation, direct discharge drains the rest of
        the upper zone storage:

        >>> recstep(2)
        >>> derived.dt = 1./recstep
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(0.5)
        >>> fluxes.q0
        q0(0.5)
        >>> states.uz
        uz(0.0)

        Applying a more reasonable storage coefficient results in:

        >>> k(.5)
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(0.5)
        >>> fluxes.q0
        q0(0.25)
        >>> states.uz
        uz(0.25)

        Adding an input of 0.3 mm results the same percolation value (which,
        in the given example, is determined by the maximum percolation rate
        only), but in an increases value of the direct response (which
        always depends on the actual upper zone storage directly):

        >>> fluxes.inuz = .3
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(0.5)
        >>> fluxes.q0
        q0(0.64)
        >>> states.uz
        uz(0.16)

        Due to the same reasons, another increase in numerical accuracy has
        no impact on percolation but decreases the direct response in the
        given example:

        >>> recstep(200)
        >>> derived.dt = 1./recstep
        >>> states.uz = 1.
        >>> model.calc_q0_perc_uz_v1()
        >>> fluxes.perc
        perc(0.5)
        >>> fluxes.q0
        q0(0.421708)
        >>> states.uz
        uz(0.378292)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    flu.perc = 0.
    flu.q0 = 0.
    for jdx in range(con.recstep):
        # First state update related to the upper zone input.
        sta.uz += der.dt*flu.inuz
        # Second state update related to percolation.
        d_perc = min(der.dt*con.percmax*flu.contriarea, sta.uz)
        sta.uz -= d_perc
        flu.perc += d_perc
        # Third state update related to fast runoff response.
        if sta.uz > 0.:
            if flu.contriarea > 0.:
                d_q0 = (der.dt*con.k *
                        (sta.uz/flu.contriarea)**(1.+con.alpha))
                d_q0 = min(d_q0, sta.uz)
            else:
                d_q0 = sta.uz
            sta.uz -= d_q0
            flu.q0 += d_q0
        else:
            d_q0 = 0.


def calc_lz_v1(self):
    """Update the lower zone layer in accordance with percolation from
    upper groundwater to lower groundwater and/or in accordance with
    lake precipitation.

    Required control parameters:
      |NmbZones|
      |ZoneType|

    Required derived parameters:
      |RelLandArea|
      |RelZoneArea|

    Required fluxes sequences:
      |PC|
      |Perc|

    Updated state sequence:
      |LZ|

    Basic equation:
      :math:`\\frac{dLZ}{dt} = Perc + Pc`

    Examples:
        At first, a subbasin with two field zones is assumed (the zones
        could be of type forest or glacier as well).  In such zones,
        precipitation does not fall directly into the lower zone layer,
        hence the given precipitation of 2mm has no impact.  Only
        the actual percolation from the upper zone layer (underneath
        both field zones) is added to the lower zone storage:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(2)
        >>> zonetype(FIELD, FIELD)
        >>> derived.rellandarea = 1.
        >>> derived.relzonearea = 2./3., 1./3.
        >>> fluxes.perc = 2.
        >>> fluxes.pc = 5.
        >>> states.lz = 10.
        >>> model.calc_lz_v1()
        >>> states.lz
        lz(12.0)

        If the second zone is an internal lake, its precipitation falls
        on the lower zone layer directly.  Note that only 5/3mm
        precipitation are added, due to the relative size of the
        internal lake within the subbasin. Percolation from the upper
        zone layer increases the lower zone storage only by two thirds
        of its original value, due to the larger spatial extend of
        the lower zone layer:

        >>> zonetype(FIELD, ILAKE)
        >>> derived.rellandarea = 2./3.
        >>> derived.relzonearea = 2./3., 1./3.
        >>> states.lz = 10.
        >>> model.calc_lz_v1()
        >>> states.lz
        lz(13.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    sta.lz += der.rellandarea*flu.perc
    for k in range(con.nmbzones):
        if con.zonetype[k] == ILAKE:
            sta.lz += der.relzonearea[k]*flu.pc[k]


def calc_el_lz_v1(self):
    """Calculate lake evaporation.

    Required control parameters:
        |NmbZones|
        |ZoneType|
        |TTIce|

    Required derived parameters:
        |RelZoneArea|

    Required fluxes sequences:
        |TC|
        |EPC|

    Updated state sequence:
        |LZ|

    Basic equations:
        :math:`\\frac{dLZ}{dt} = -EL` \n
        :math:`EL = \\Bigl \\lbrace
        {
        {EPC \\ | \\ TC > TTIce}
        \\atop
        {0 \\ | \\ TC \\leq TTIce}
        }`

    Examples:
        Six zones of the same size are initialized.  The first three
        zones are no internal lakes, they can not exhibit any lake
        evaporation.  Of the last three zones, which are internal lakes,
        only the last one evaporates water.  For zones five and six,
        evaporation is suppressed due to an assumed ice layer, whenever
        the associated theshold temperature is not exceeded:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(6)
        >>> zonetype(FIELD, FOREST, GLACIER, ILAKE, ILAKE, ILAKE)
        >>> ttice(-1.)
        >>> derived.relzonearea = 1./6.
        >>> fluxes.epc = .6
        >>> fluxes.tc = 0., 0., 0., 0., -1., -2.
        >>> states.lz = 10.
        >>> model.calc_el_lz_v1()
        >>> fluxes.el
        el(0.0, 0.0, 0.0, 0.6, 0.0, 0.0)
        >>> states.lz
        lz(9.9)

        Note that internal lakes always contain water.  Hence, the
        HydPy-H-Land model allows for negative values of the lower
        zone storage:

        >>> states.lz = .05
        >>> model.calc_el_lz_v1()
        >>> fluxes.el
        el(0.0, 0.0, 0.0, 0.6, 0.0, 0.0)
        >>> states.lz
        lz(-0.05)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nmbzones):
        if (con.zonetype[k] == ILAKE) and (flu.tc[k] > con.ttice[k]):
            flu.el[k] = flu.epc[k]
            sta.lz -= der.relzonearea[k]*flu.el[k]
        else:
            flu.el[k] = 0.


def calc_q1_lz_v1(self):
    """Calculate the slow response of the lower zone layer.

    Required control parameters:
        |K4|
        |Gamma|

    Calculated fluxes sequence:
        |Q1|

    Updated state sequence:
        |LZ|

    Basic equations:
        :math:`\\frac{dLZ}{dt} = -Q1` \n
        :math:`Q1 = \\Bigl \\lbrace
        {
        {K4 \\cdot LZ^{1+Gamma} \\ | \\ LZ > 0}
        \\atop
        {0 \\ | \\ LZ\\leq 0}
        }`

    Examples:
        As long as the lower zone storage is negative...

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> k4(.2)
        >>> gamma(0.)
        >>> states.lz = -2.
        >>> model.calc_q1_lz_v1()
        >>> fluxes.q1
        q1(0.0)
        >>> states.lz
        lz(-2.0)

        ...or zero, no slow discharge response occurs:

        >>> states.lz = 0.
        >>> model.calc_q1_lz_v1()
        >>> fluxes.q1
        q1(0.0)
        >>> states.lz
        lz(0.0)

        For storage values above zero the linear...

        >>> states.lz = 2.
        >>> model.calc_q1_lz_v1()
        >>> fluxes.q1
        q1(0.2)
        >>> states.lz
        lz(1.8)

        ...or nonlinear storage routing equation applies:

        >>> gamma(1.)
        >>> states.lz = 2.
        >>> model.calc_q1_lz_v1()
        >>> fluxes.q1
        q1(0.4)
        >>> states.lz
        lz(1.6)

        Note that the assumed length of the simulation step is only a
        half day. Hence the effective value of the storage coefficient
        is not 0.2 but 0.1:

        >>> k4
        k4(0.2)
        >>> k4.value
        0.1
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    if sta.lz > 0.:
        flu.q1 = con.k4*sta.lz**(1.+con.gamma)
    else:
        flu.q1 = 0.
    sta.lz -= flu.q1


def calc_inuh_v1(self):
    """Calculate the unit hydrograph input.

    Required derived parameters:
      |RelLandArea|

    Required flux sequences:
      |Q0|
      |Q1|

    Calculated flux sequence:
      |InUH|

    Basic equation:
        :math:`InUH = Q0 + Q1`

    Example:
        The unit hydrographs receives base flow from the whole subbasin
        and direct flow from zones of type field, forest and glacier only.
        In the following example, these occupy only one half of the
        subbasin, which is why the partial input of q0 is halved:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> derived.rellandarea = 0.5
        >>> fluxes.q0 = 4.
        >>> fluxes.q1 = 1.
        >>> model.calc_inuh_v1()
        >>> fluxes.inuh
        inuh(3.0)

    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.inuh = der.rellandarea*flu.q0+flu.q1


def calc_outuh_quh_v1(self):
    """Calculate the unit hydrograph output (convolution).

    Required derived parameters:
        |UH|
        |NmbUH|

    Required flux sequences:
        |Q0|
        |Q1|
        |InUH|

    Updated log sequence:
        |QUH|

    Calculated flux sequence:
        |OutUH|

    Examples:
        Prepare a unit hydrograph with only three ordinates ---
        representing a fast catchment response compared to the selected
        step size:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> derived.nmbuh = 3
        >>> derived.uh.shape = derived.nmbuh
        >>> derived.uh = 0.3, 0.5, 0.2
        >>> logs.quh.shape = 3
        >>> logs.quh = 1., 3., 0.

        Without new input, the actual output is simply the first value
        stored in the logging sequence and the values of the logging
        sequence are shifted to the left:

        >>> fluxes.inuh = 0.
        >>> model.calc_outuh_quh_v1()
        >>> fluxes.outuh
        outuh(1.0)
        >>> logs.quh
        quh(3.0, 0.0, 0.0)

        With an new input of 4mm, the actual output consists of the first
        value stored in the logging sequence and the input value
        multiplied with the first unit hydrograph ordinate.  The updated
        logging sequence values result from the multiplication of the
        input values and the remaining ordinates:

        >>> fluxes.inuh = 4.
        >>> model.calc_outuh_quh_v1()
        >>> fluxes.outuh
        outuh(4.2)
        >>> logs.quh
        quh(2.0, 0.8, 0.0)

        The next example demonstates the updating of non empty logging
        sequence:

        >>> fluxes.inuh = 4.
        >>> model.calc_outuh_quh_v1()
        >>> fluxes.outuh
        outuh(3.2)
        >>> logs.quh
        quh(2.8, 0.8, 0.0)

        A unit hydrograph with only one ordinate results in the direct
        routing of the input:

        >>> derived.nmbuh = 1
        >>> derived.uh.shape = derived.nmbuh
        >>> derived.uh = 1.
        >>> fluxes.inuh = 0.
        >>> logs.quh.shape = 1
        >>> logs.quh = 0.
        >>> model.calc_outuh_quh_v1()
        >>> fluxes.outuh
        outuh(0.0)
        >>> logs.quh
        quh(0.0)
        >>> fluxes.inuh = 4.
        >>> model.calc_outuh_quh()
        >>> fluxes.outuh
        outuh(4.0)
        >>> logs.quh
        quh(0.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    flu.outuh = der.uh[0]*flu.inuh+log.quh[0]
    for jdx in range(1, der.nmbuh):
        log.quh[jdx-1] = der.uh[jdx]*flu.inuh+log.quh[jdx]


def calc_qt_v1(self):
    """Calculate the total discharge after possible abstractions.

    Required control parameter:
      |Abstr|

    Required flux sequence:
      |OutUH|

    Calculated flux sequence:
      |QT|

    Basic equation:
        :math:`QT = max(OutUH - Abstr, 0)`

    Examples:
        Trying to abstract less then available, as much as available and
        less then available results in:

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> abstr(2.)
        >>> fluxes.outuh = 2.
        >>> model.calc_qt_v1()
        >>> fluxes.qt
        qt(1.0)
        >>> fluxes.outuh = 1.
        >>> model.calc_qt_v1()
        >>> fluxes.qt
        qt(0.0)
        >>> fluxes.outuh = .5
        >>> model.calc_qt_v1()
        >>> fluxes.qt
        qt(0.0)

        Note that "negative abstractions" are allowed:

        >>> abstr(-2.)
        >>> fluxes.outuh = 1.
        >>> model.calc_qt_v1()
        >>> fluxes.qt
        qt(2.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.qt = max(flu.outuh-con.abstr, 0.)


def update_q_v1(self):
    """Update the outlet link sequence."""
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += der.qfactor*flu.qt


class Model(modeltools.Model):
    """The HydPy-H-Land base model."""
    _RUN_METHODS = (calc_tc_v1,
                    calc_tmean_v1,
                    calc_fracrain_v1,
                    calc_rfc_sfc_v1,
                    calc_pc_v1,
                    calc_ep_v1,
                    calc_epc_v1,
                    calc_tf_ic_v1,
                    calc_ei_ic_v1,
                    calc_sp_wc_v1,
                    calc_melt_sp_wc_v1,
                    calc_refr_sp_wc_v1,
                    calc_in_wc_v1,
                    calc_glmelt_in_v1,
                    calc_r_sm_v1,
                    calc_cf_sm_v1,
                    calc_ea_sm_v1,
                    calc_inuz_v1,
                    calc_contriarea_v1,
                    calc_q0_perc_uz_v1,
                    calc_lz_v1,
                    calc_el_lz_v1,
                    calc_q1_lz_v1,
                    calc_inuh_v1,
                    calc_outuh_quh_v1,
                    calc_qt_v1)
    _OUTLET_METHODS = (update_q_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Runoff [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of the hland model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_parameters.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
# -*- coding: utf-8 -*-

# import...
# ...standard library
from __future__ import division, print_function
# ...third party
import numpy
# ...HydPy specific
from hydpy.core import parametertools
# ...model specific
from hydpy.models.hland.hland_constants import FIELD, FOREST, ILAKE, GLACIER
from hydpy.models.hland.hland_constants import CONSTANTS


class MultiParameter(parametertools.ZipParameter):
    """Base class for handling parameters of the HydPy-H-Land model
    (potentially) handling multiple values.

    Due to inheriting from |ZipParameter|, additional keyword zipping
    functionality is offered.  The optional `kwargs` are checked for
    the keywords `field`, `forest`, `glacier`, `ilake,` and `default`.
    If available, the respective values are used to define the values
    of those 1-dimensional arrays, whose entries are related to the
    different zone types. Also the method
    |parametertools.MultiParameter.compress_repr| tries to find compressed
    string representations based on the mentioned zone types.

    Examples:

        Prepare a |hland_parameters.MultiParameter| instance:

        >>> from hydpy.models.hland.hland_parameters import MultiParameter
        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> mp = MultiParameter()
        >>> mp.DIM, mp.TYPE, mp.TIME = 1, float, None
        >>> mp.subpars = control

        Usually, one would indirectly define its shape through parameter
        |NmbZones|:

        >>> mp.shape
        Traceback (most recent call last):
        ...
        RuntimeError: Shape information for parameter `multiparameter` can \
only be retrieved after it has been defined.  You can do this manually, \
but usually it is done automatically by defining the value of \
parameter `nmbzones` first in each parameter control file.

        But here it is set manually to the value 5 for representing
        five different zone types:

        >>> zonetype.shape = 5
        >>> zonetype(FIELD, FOREST, GLACIER, ILAKE, FIELD)
        >>> mp.shape = 5

        Assign values to all four zone types explicitly:

        >>> mp(field=2., forest=1., glacier=4., ilake=3.)
        >>> mp
        multiparameter(field=2.0, forest=1.0, glacier=4.0, ilake=3.0)
        >>> mp.values
        array([ 2.,  1.,  4.,  3.,  2.])

        Specify a default value for all zone types not included in the
        keyword list:

        >>> mp(field=2., forest=1., default=9.)
        >>> mp
        multiparameter(field=2.0, forest=1.0, glacier=9.0, ilake=9.0)
        >>> mp.values
        array([ 2.,  1.,  9.,  9.,  2.])

        If no default value is given, numpys `nan` is applied:

        >>> mp(field=2., forest=1.)
        >>> mp
        multiparameter(field=2.0, forest=1.0, glacier=nan, ilake=nan)
        >>> mp.values
        array([  2.,   1.,  nan,  nan,   2.])

        Of course, the usual value assignments remain unaffected:

        >>> mp.values = 5.
        >>> mp
        multiparameter(5.0)
        >>> mp.values
        array([ 5.,  5.,  5.,  5.,  5.])

        >>> mp.values = 5., 4., 3., 2., 1.
        >>> mp
        multiparameter(5.0, 4.0, 3.0, 2.0, 1.0)
        >>> mp.values
        array([ 5.,  4.,  3.,  2.,  1.])

    Another feature of |hland_parameters.MultiParameter| is that it
    relates the |property| |parametertools.MultiParameter.verifymask|
    to the defined zone types.  This requires the definition of the
    class attribute |hland_parameters.MultiParameter.REQUIRED_VALUES|
    for |hland_parameters.MultiParameter| subclasses.

    Examples:

        When values for all zone types are required, all entries of the
        verification mask are `True`:

        >>> mp.REQUIRED_VALUES = (FIELD, FOREST, GLACIER, ILAKE)
        >>> mp.verifymask
        array([ True,  True,  True,  True,  True], dtype=bool)

        When values for field and forest zones are required only, the
        entries related to glacier and ilake zones are `False`:

        >>> mp.REQUIRED_VALUES = (FIELD, FOREST)
        >>> mp.verifymask
        array([ True,  True, False, False,  True], dtype=bool)

    """
    REQUIRED_VALUES = (FIELD, FOREST, GLACIER, ILAKE)
    MODEL_CONSTANTS = CONSTANTS

    @property
    def refparameter(self):
        """Alias for the associated instance of |ZoneType|.
        """
        return self.subpars.pars.control.zonetype

    @property
    def shapeparameter(self):
        """Alias for the associated instance of |NmbZones|.
        """
        return self.subpars.pars.control.nmbzones


class MultiParameterSoil(MultiParameter):
    """Base class for handling parameters of the hland model (potentially)
    handling multiple values relevant for `soil zones` (and interception).
    """
    REQUIRED_VALUES = (FIELD, FOREST)


class MultiParameterLand(MultiParameter):
    """Base class for handling parameters of the hland model (potentially)
    handling multiple values relevant for all `land zones`.
    """
    REQUIRED_VALUES = (FIELD, FOREST, GLACIER)


class MultiParameterLake(MultiParameter):
    """Base class for handling parameters of the hland model (potentially)
    handling multiple values relevant for `lake zones` only.
    """
    REQUIRED_VALUES = (ILAKE,)


class MultiParameterGlacier(MultiParameter):
    """Base class for handling parameters of the hland model (potentially)
    handling multiple values relevant for `glacier zones` only.
    """
    REQUIRED_VALUES = (GLACIER,)


class MultiParameterNoGlacier(MultiParameter):
    """Base class for handling parameters of the hland model (potentially)
    handling multiple values relevant for `glacier free zones` only.
    """
    REQUIRED_VALUES = (FIELD, FOREST, ILAKE)


class Parameters(parametertools.Parameters):
    """All parameters of the hland model."""

    def update(self):
        """Determine the values of the parameters handled by
        |DerivedParameters| based on the values of the parameters
        handled by |ControlParameters|.  The results of the different
        methods are not interdependent, meaning their order could be changed.
        """
        self.calc_relzonearea()
        self.calc_landzonearea()
        self.calc_soilarea()
        self.calc_ttm()
        self.calc_dt()
        self.calc_nmbuh_uh()
        self.calc_qfactor()

    def calc_relzonearea(self):
        """Calculate the relative areas of all zones within the subbasin.

        Required control parameters:
          |ZoneArea|

        Calculated derived parameters:
          |RelZoneArea|

        Examples:

            With one single zone, its relative area is one by definition:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> nmbzones(1)
            >>> zonearea(1111.)
            >>> model.parameters.calc_relzonearea()
            >>> derived.relzonearea
            relzonearea(1.0)

            An example for three zones of different sizes:

            >>> nmbzones(3)
            >>> zonearea(1., 3., 2.)
            >>> model.parameters.calc_relzonearea()
            >>> derived.relzonearea
            relzonearea(0.166667, 0.5, 0.333333)

        """
        con = self.control
        der = self.derived
        der.relzonearea(con.zonearea/sum(con.zonearea))

    def calc_landzonearea(self):
        """Calculate the fraction of the summed area of all "land zones"
        (of type FIELD, FOREST, or ILAKE) and the total subbasin area, and
        calculate the fractions of all "land zones" and the total "land area"
        of the subbasin.

        Required control parameters:
          |Area|
          |ZoneArea|
          |ZoneType|

        Calculated derived parameters:
          |RelLandArea|
          |RelLandZoneArea|

        Examples:

            With all zones being "land zones", the relative land area is
            one by definition and the relative "land zone" areas are in
            accordance with the original zone areas:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> nmbzones(3)
            >>> zonetype(FIELD, FOREST, GLACIER)
            >>> area(100.)
            >>> zonearea(25., 25., 50.)
            >>> model.parameters.calc_landzonearea()
            >>> derived.rellandarea
            rellandarea(1.0)
            >>> derived.rellandzonearea
            rellandzonearea(field=0.25, forest=0.25, glacier=0.5)

            With one zone being a lake zone, the relative "land area" is
            decreased and the relative "land zone" areas are increased ---
            except the one related to the internal lake, which is set to zero:

            >>> zonetype(FIELD, FOREST, ILAKE)
            >>> model.parameters.calc_landzonearea()
            >>> derived.rellandarea
            rellandarea(0.5)
            >>> derived.rellandzonearea
            rellandzonearea(field=0.5, forest=0.5, ilake=0.0)

            With all zones being lake zones, all relative areas are zero:

            >>> zonetype(ILAKE, ILAKE, ILAKE)
            >>> model.parameters.calc_landzonearea()
            >>> derived.rellandarea
            rellandarea(0.0)
            >>> derived.rellandzonearea
            rellandzonearea(0.0)

        """
        con = self.control
        der = self.derived
        landzonearea = con.zonearea.values.copy()
        landzonearea[con.zonetype.values == ILAKE] = 0.
        landarea = numpy.sum(landzonearea)
        if landarea > 0.:
            der.rellandzonearea(landzonearea/landarea)
        else:
            der.rellandzonearea(0.)
        der.rellandarea(landarea/con.area)

    def calc_soilarea(self):
        """Calculate the fraction of the summed area of all "soil zones"
        (of type FIELD or FOREST) and the total subbasin area, and
        calculate the fractions of all "soil zones" and the total "soil area"
        of the subbasin.

        Required control parameters:
          |Area|
          |ZoneArea|
          |ZoneType|

        Calculated derived parameters:
          |RelSoilArea|
          |RelSoilZoneArea|

        Examples:

            With all zones being "soil zones", the relative land area is
            one by definition and the relative "soil zone" areas are in
            accordance with the original zone areas:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> nmbzones(4)
            >>> zonetype(FIELD, FOREST, FIELD, FOREST)
            >>> area(100.)
            >>> zonearea(25., 25., 25., 25.)
            >>> model.parameters.calc_soilarea()
            >>> derived.relsoilarea
            relsoilarea(1.0)
            >>> derived.relsoilzonearea
            relsoilzonearea(0.25)

            With one zone being a lake zone one one zone being a glacier
            zone, the relative "soil area" is decreased and the relative
            "soil zone" areas are increased --- except the ones related to
            the internal lake and the glacier, which are set to zero:

            >>> zonetype(FIELD, FOREST, GLACIER, ILAKE)
            >>> model.parameters.calc_soilarea()
            >>> derived.relsoilarea
            relsoilarea(0.5)
            >>> derived.relsoilzonearea
            relsoilzonearea(field=0.5, forest=0.5, glacier=0.0, ilake=0.0)

            With all zones being lake or glacier zones, all relative areas
            are zero:

            >>> zonetype(GLACIER, GLACIER, ILAKE, ILAKE)
            >>> model.parameters.calc_soilarea()
            >>> derived.relsoilarea
            relsoilarea(0.0)
            >>> derived.relsoilzonearea
            relsoilzonearea(0.0)

        """
        con = self.control
        der = self.derived
        soilzonearea = con.zonearea.values.copy()
        soilzonearea[con.zonetype.values == GLACIER] = 0.
        soilzonearea[con.zonetype.values == ILAKE] = 0.
        soilarea = numpy.sum(soilzonearea)
        if soilarea > 0.:
            der.relsoilzonearea(soilzonearea/soilarea)
        else:
            der.relsoilzonearea(0.)
        der.relsoilarea(soilarea/con.area)

    def calc_ttm(self):
        """Calculate the threshold temperature for melting and refreezing.

        Required control parameters:
          |TT|
          |DTTM|

        Calculated derived parameter:
          |TTM|

        Basic equation:
          :math:`TTM = TT+DTTM`

        Example:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> nmbzones(1)
            >>> tt(1.)
            >>> dttm(-2.)
            >>> model.parameters.calc_ttm()
            >>> derived.ttm
            ttm(-1.0)
        """
        con = self.control
        der = self.derived
        der.ttm(con.tt+con.dttm)

    def calc_dt(self):
        """Determine the relative time step size for solving the upper
        zone layer routine.

        Required control parameter:
          |RecStep|

        Calculated derived parameter:
          |DT|

        Basic equation:
          :math:`DT = \\frac{1}{RecStep}`

        Examples:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> simulationstep('12h')
            >>> recstep(2.)
            >>> model.parameters.calc_dt()
            >>> derived.dt
            dt(1.0)
            >>> recstep(10.)
            >>> model.parameters.calc_dt()
            >>> derived.dt
            dt(0.2)

            Note that the value assigned to recstep is related to the given
            parameter step size of one day.  The actually applied recstep of
            the last example is:

            >>> recstep.value
            5

        """
        con = self.control
        der = self.derived
        der.dt(1./con.recstep)

    def calc_qfactor(self):
        """Determine the factor for converting values of |QT| [mm/T] to
        values of |Q| [m³/s].

        Required control parameter:
          |Area|

        Calculated derived parameter:
          |QFactor|

        Example:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> simulationstep('12h')
            >>> area(50.)
            >>> model.parameters.calc_qfactor()
            >>> derived.qfactor
            qfactor(1.157407)

        """
        con = self.control
        der = self.derived
        der.qfactor(con.area*1000./der.qfactor.simulationstep.seconds)

    def calc_nmbuh_uh(self):
        """Calculate the ordinates of the triangle unit hydrograph.

        Note that also the shape of sequence |QUH| is defined in accordance
        with NmbUH.

        Required control parameter:
          |MaxBaz|

        Calculated derived parameters:
          NmbUH
          UH

        Prepared log sequence:
          |QUH|

        Examples:

            MaxBaz determines the end point of the triangle.  A value of
            MaxBaz being not larger than the simulation step size is
            identical with applying no unit hydrograph at all:

            >>> from hydpy.models.hland import *
            >>> parameterstep('1d')
            >>> simulationstep('12h')
            >>> maxbaz(0.)
            >>> model.parameters.calc_nmbuh_uh()
            >>> derived.nmbuh
            nmbuh(1)
            >>> logs.quh.shape
            (1,)
            >>> derived.uh
            uh(1.0)

            Note that, due to difference of the parameter and the simulation
            step size in the given example, the largest assignement resulting
            in a `inactive` unit hydrograph is 1/2:

            >>> maxbaz(0.5)
            >>> model.parameters.calc_nmbuh_uh()
            >>> derived.nmbuh
            nmbuh(1)
            >>> logs.quh.shape
            (1,)
            >>> derived.uh
            uh(1.0)

            When MaxBaz is in accordance with two simulation steps, both
            unit hydrograph ordinats must be 1/2, due to symmetry of the
            triangle:

            >>> maxbaz(1.)
            >>> model.parameters.calc_nmbuh_uh()
            >>> derived.nmbuh
            nmbuh(2)
            >>> logs.quh.shape
            (2,)
            >>> derived.uh
            uh(0.5)

            A MaxBaz value in accordance with three simulation steps results
            --- when expressed as fractions --- in the ordinate values 2/9,
            5/9, and 2/9:

            >>> maxbaz(1.5)
            >>> model.parameters.calc_nmbuh_uh()
            >>> derived.nmbuh
            nmbuh(3)
            >>> logs.quh.shape
            (3,)
            >>> derived.uh
            uh(0.222222, 0.555556, 0.222222)

            And a final example, where the end of the triangle lies within
            a simulation step, resulting in the fractions 8/49, 23/49, 16/49,
            and 2/49:

            >>> maxbaz(1.75)
            >>> model.parameters.calc_nmbuh_uh()
            >>> derived.nmbuh
            nmbuh(4)
            >>> logs.quh.shape
            (4,)
            >>> derived.uh
            uh(0.163265, 0.469388, 0.326531, 0.040816)

        """
        con = self.control
        der = self.derived
        log = self.model.sequences.logs
        # Determine UH parameters...
        if con.maxbaz <= 1.:
            # ...when MaxBaz smaller than or equal to the simulation time step.
            der.nmbuh = 1
            der.uh.shape = 1
            der.uh(1.)
            log.quh.shape = 1
        else:
            # ...when MaxBaz is greater than the simulation time step.
            # Define some shortcuts for the following calculations.
            full = con.maxbaz.value
            # Now comes a terrible trick due to rounding problems coming from
            # the conversation of the SMHI parameter set to the HydPy
            # parameter set.  Time to get rid of it...
            if (full % 1.) < 1e-4:
                full //= 1.
            full_f = int(numpy.floor(full))
            full_c = int(numpy.ceil(full))
            half = full/2.
            half_f = int(numpy.floor(half))
            half_c = int(numpy.ceil(half))
            full_2 = full**2.
            # Calculate the triangle ordinate(s)...
            der.nmbuh(full_c)
            der.uh.shape = full_c
            log.quh.shape = full_c
            # ...of the rising limb.
            points = numpy.arange(1, half_f+1)
            der.uh[:half_f] = (2.*points-1.)/(2.*full_2)
            # ...around the peak (if it exists).
            if numpy.mod(half, 1.) != 0.:
                der.uh[half_f] = \
                    ((half_c-half)/full +
                     (2*half**2.-half_f**2.-half_c**2.)/(2.*full_2))
            # ...of the falling limb (eventually except the last one).
            points = numpy.arange(half_c+1., full_f+1.)
            der.uh[half_c:full_f] = 1./full-(2.*points-1.)/(2.*full_2)
            # ...at the end (if not already done).
            if numpy.mod(full, 1.) != 0.:
                der.uh[full_f] = ((full-full_f)/full -
                                  (full_2-full_f**2.)/(2.*full_2))
            # Normalize the ordinates.
            der.uh(der.uh/numpy.sum(der.uh))

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hland/hland_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import sequencetools
from hydpy.models.hland.hland_constants import ILAKE


class Ic(sequencetools.StateSequence):
    """Interception storage [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with :math:`IC \\leq ICMAX`.

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(5)
        >>> icmax(2.)
        >>> states.ic(-1.,0., 1., 2., 3.)
        >>> states.ic
        ic(0.0, 0.0, 1.0, 2.0, 2.0)
        """
        if upper is None:
            control = self.subseqs.seqs.model.parameters.control
            upper = control.icmax
        sequencetools.StateSequence.trim(self, lower, upper)


class SP(sequencetools.StateSequence):
    """Frozen water stored in the snow layer [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (None, None)

    def trim(self, lower=None, upper=None):
        """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`.

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(7)
        >>> whc(.1)
        >>> states.wc.values = -1., 0., 1., -1., 0., .5, 1.
        >>> states.sp(-1., 0., 0., 5., 5., 5., 5.)
        >>> states.sp
        sp(0.0, 0.0, 10.0, 5.0, 5.0, 5.0, 10.0)
        """
        whc = self.subseqs.seqs.model.parameters.control.whc
        wc = self.subseqs.wc
        if lower is None:
            if wc.values is not None:
                lower = numpy.clip(wc/whc, 0., numpy.inf)
            else:
                lower = 0.
        sequencetools.StateSequence.trim(self, lower, upper)


class WC(sequencetools.StateSequence):
    """Liquid water content of the snow layer [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def trim(self, lower=None, upper=None):
        """Trim values in accordance with :math:`WC \\leq WHC \\cdot SP`.

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(7)
        >>> whc(.1)
        >>> states.sp = 0., 0., 0., 5., 5., 5., 5.
        >>> states.wc(-1., 0., 1., -1., 0., .5, 1.)
        >>> states.wc
        wc(0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5)
        """
        whc = self.subseqs.seqs.model.parameters.control.whc
        sp = self.subseqs.sp
        if (upper is None) and (sp.values is not None):
            upper = whc*sp
        sequencetools.StateSequence.trim(self, lower, upper)


class SM(sequencetools.StateSequence):
    """Soil moisture [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def trim(self, lower=None, upper=None):
        """Trim values in accordance with :math:`SM \\leq FC`.

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(5)
        >>> fc(200.)
        >>> states.sm(-100.,0., 100., 200., 300.)
        >>> states.sm
        sm(0.0, 0.0, 100.0, 200.0, 200.0)
        """
        if upper is None:
            upper = self.subseqs.seqs.model.parameters.control.fc
        sequencetools.StateSequence.trim(self, lower, upper)


class UZ(sequencetools.StateSequence):
    """Storage in the upper zone layer [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class LZ(sequencetools.StateSequence):
    """Storage in the lower zone layer [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (None, None)

    def trim(self, lower=None, upper=None):
        """Trim negative value whenever there is no internal lake within
        the respective subbasin.

        >>> from hydpy.models.hland import *
        >>> parameterstep('1d')
        >>> nmbzones(2)
        >>> zonetype(FIELD, ILAKE)
        >>> states.lz(-1.)
        >>> states.lz
        lz(-1.0)
        >>> zonetype(FIELD, FOREST)
        >>> states.lz(-1.0)
        >>> states.lz
        lz(0.0)
        >>> states.lz(1.)
        >>> states.lz
        lz(1.0)
        """
        if upper is None:
            control = self.subseqs.seqs.model.parameters.control
            if not any(control.zonetype.values == ILAKE):
                lower = 0.
        sequencetools.StateSequence.trim(self, lower, upper)


class StateSequences(sequencetools.StateSequences):
    """State sequences of the HydPy-H-Land model."""
    _SEQCLASSES = (Ic, SP, WC, SM, UZ, LZ)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
# -*- coding: utf-8 -*-
"""The HydPy-H-Stream model is an very simple routing approach.  More
precisely, it is a simplification of the Muskingum approach, which
itself can be seen as a very simple finite difference solution of the
routing problem.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from hstream
from hydpy.models.hstream.hstream_parameters import Parameters
from hydpy.models.hstream.hstream_control import ControlParameters
from hydpy.models.hstream.hstream_derived import DerivedParameters
from hydpy.models.hstream.hstream_states import StateSequences
from hydpy.models.hstream.hstream_inlets import InletSequences
from hydpy.models.hstream.hstream_outlets import OutletSequences
from hydpy.models.hstream.hstream_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class Lag(parametertools.SingleParameter):
    """Time lag between inflow and outflow [T]."""
    NDIM, TYPE, TIME, SPAN = 0, float, False, (0., None)


class Damp(parametertools.SingleParameter):
    """Damping of the hydrograph [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., 1.)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of hstream, directly defined by the user."""
    _PARCLASSES = (Lag, Damp)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class NmbSegments(parametertools.SingleParameter):
    """Number of river segments [-]."""
    NDIM, TYPE, TIME, SPAN = 0, int, None, (0, None)


class C1(parametertools.SingleParameter):
    """First coefficient of the muskingum working formula [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., .5)


class C2(parametertools.SingleParameter):
    """Second coefficient of the muskingum working formula [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., 1.)


class C3(parametertools.SingleParameter):
    """Third coefficient of the muskingum working formula [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., .5)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of hstream, indirectly defined by the user."""
    _PARCLASSES = (NmbSegments, C1, C2, C3)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_inlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Runoff [m³/s]."""
    NDIM, NUMERIC = 0, False


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of the hstream model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools


def calc_qjoints_v1(self):
    """Apply the routing equation.

    Required derived parameters:
      |NmbSegments|
      |C1|
      |C2|
      |C3|

    Updated state sequence:
      |QJoints|

    Basic equation:
      :math:`Q_{space+1,time+1} =
      c1 \\cdot Q_{space,time+1} +
      c2 \\cdot Q_{space,time} +
      c3 \\cdot Q_{space+1,time}`

    Examples:

        Firstly, define a reach divided into 4 segments:

        >>> from hydpy.models.hstream import *
        >>> parameterstep('1d')
        >>> derived.nmbsegments(4)
        >>> states.qjoints.shape = 5

        Zero damping is achieved through the following coefficients:

        >>> derived.c1(0.)
        >>> derived.c2(1.)
        >>> derived.c3(0.)

        For initialization, assume a base flow of 2m³/s:

        >>> states.qjoints.old = 2.
        >>> states.qjoints.new = 2.

        Through successive assignements of different discharge values
        to the upper junction one can see, that these discharge values
        are simply shifted from each junction to the respective lower
        junction at each time step:

        >>> states.qjoints[0] = 5.
        >>> model.calc_qjoints_v1()
        >>> model.new2old()
        >>> states.qjoints
        qjoints(5.0, 2.0, 2.0, 2.0, 2.0)
        >>> states.qjoints[0] = 8.
        >>> model.calc_qjoints_v1()
        >>> model.new2old()
        >>> states.qjoints
        qjoints(8.0, 5.0, 2.0, 2.0, 2.0)
        >>> states.qjoints[0] = 6.
        >>> model.calc_qjoints_v1()
        >>> model.new2old()
        >>> states.qjoints
        qjoints(6.0, 8.0, 5.0, 2.0, 2.0)

        With the maximum damping allowed, the values of the derived
        parameters are:

        >>> derived.c1(.5)
        >>> derived.c2(.0)
        >>> derived.c3(.5)

        Assuming again a base flow of 2m³/s and the same input values
        results in:

        >>> states.qjoints.old = 2.
        >>> states.qjoints.new = 2.

        >>> states.qjoints[0] = 5.
        >>> model.calc_qjoints_v1()
        >>> model.new2old()
        >>> states.qjoints
        qjoints(5.0, 3.5, 2.75, 2.375, 2.1875)
        >>> states.qjoints[0] = 8.
        >>> model.calc_qjoints_v1()
        >>> model.new2old()
        >>> states.qjoints
        qjoints(8.0, 5.75, 4.25, 3.3125, 2.75)
        >>> states.qjoints[0] = 6.
        >>> model.calc_qjoints_v1()
        >>> model.new2old()
        >>> states.qjoints
        qjoints(6.0, 5.875, 5.0625, 4.1875, 3.46875)

    """
    der = self.parameters.derived.fastaccess
    new = self.sequences.states.fastaccess_new
    old = self.sequences.states.fastaccess_old
    for j in range(der.nmbsegments):
        new.qjoints[j+1] = (der.c1*new.qjoints[j] +
                            der.c2*old.qjoints[j] +
                            der.c3*old.qjoints[j+1])


def pick_q_v1(self):
    """Assign the actual value of the inlet sequence to the upper joint
    of the subreach upstream."""
    sta = self.sequences.states.fastaccess
    inl = self.sequences.inlets.fastaccess
    sta.qjoints[0] = inl.q[0]


def pass_q_v1(self):
    """Assing the actual value of the lower joint of of the subreach
    downstream to the outlet sequence."""
    der = self.parameters.derived.fastaccess
    sta = self.sequences.states.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += sta.qjoints[der.nmbsegments]


class Model(modeltools.Model):
    """The HydPy-H-Stream model."""
    _INLET_METHODS = (pick_q_v1,)
    _RUN_METHODS = (calc_qjoints_v1,)
    _OUTLET_METHODS = (pass_q_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Runoff [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of the hstream model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_parameters.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import parametertools


class Parameters(parametertools.Parameters):
    """All parameters of the hstream model."""

    def update(self):
        """Determines the values of the parameters handled by
        |DerivedParameters| based on the values of the parameters.
        """
        self.calc_nmbsegments()
        self.calc_coefficients()

    def calc_nmbsegments(self):
        """Determines in how many segments the whole reach needs to be
        divided to approximate the desired lag time via integer rounding.
        Adjusts the shape of sequence |QJoints| additionally.

        Required control parameters:
          |Lag|

        Calculated derived parameters:
          |NmbSegments|

        Prepared state sequence:
          |QJoints|

        Example:

            Define a lag time of 1.4 days and a simulation step size of 12
            hours:

            >>> from hydpy.models.hstream import *
            >>> parameterstep('1d')
            >>> simulationstep('12h')
            >>> lag(1.4)

            Then the actual lag value for the simulation step size is 2.8

            >>> lag
            lag(1.4)
            >>> lag.value
            2.8

            Through rounding the number of segments is determined:

            >>> model.parameters.calc_nmbsegments()
            >>> derived.nmbsegments
            nmbsegments(3)

            The number of joints is always the number of segments plus one:

            >>> states.qjoints.shape
            (4,)

        """
        con = self.control
        der = self.derived
        der.nmbsegments = int(round(con.lag))
        self.model.sequences.states.qjoints.shape = der.nmbsegments+1

    def calc_coefficients(self):
        """Calculates the Muskingum coefficients.

        Required control parameters:
          |Damp|

        Calculated derived parameters:
          |C1|
          |C2|
          |C3|

        Basic equations:
          :math:`c_1 = \\frac{Damp}{1+Damp}`\n
          :math:`c_3 = \\frac{Damp}{1+Damp}`\n
          :math:`c_2 = 1.-c_1-c_3`

        Examples:

            If no damping is required, the coeffients are:

            >>> from hydpy.models.hstream import *
            >>> parameterstep('1d')
            >>> damp(0.)
            >>> model.parameters.calc_coefficients()
            >>> derived.c1, derived.c2, derived.c3
            (c1(0.0), c2(1.0), c3(0.0))

            The strongest damping is achieved through:

            >>> damp(1.)
            >>> model.parameters.calc_coefficients()
            >>> derived.c1, derived.c2, derived.c3
            (c1(0.5), c2(0.0), c3(0.5))

            And finally an intermediate example:

            >>> damp(.25)
            >>> model.parameters.calc_coefficients()
            >>> derived.c1, derived.c2, derived.c3
            (c1(0.2), c2(0.6), c3(0.2))

        """
        con = self.control
        der = self.derived
        der.c1 = der.c3 = numpy.clip(con.damp/(1.+con.damp), 0., .5)
        der.c2 = numpy.clip(1.-der.c1-der.c3, 0., 1.)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/hstream/hstream_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
import sys
import warnings
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import sequencetools


class QJoints(sequencetools.StateSequence):
    """Runoff at the segment junctions [m³/s]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def __call__(self, *args):
        try:
            sequencetools.StateSequence.__call__(self, *args)
        except BaseException:
            message = sys.exc_info()[1]
            sequencetools.StateSequence.__call__(self, numpy.mean(args))
            warnings.warn('Note that, due to the following problem, the'
                          'affected HydPy-H-Stream model could be initialised '
                          'with an averaged value only: %s' % message)


class StateSequences(sequencetools.StateSequences):
    """State sequences of the hstream model."""
    _SEQCLASSES = (QJoints,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
# -*- coding: utf-8 -*-
"""
The L-Lake model defines the methods and classes required for
performing lake and dam retention processes as implemented in
LARSIM.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from llake
from hydpy.models.llake.llake_control import ControlParameters
from hydpy.models.llake.llake_derived import DerivedParameters
from hydpy.models.llake.llake_fluxes import FluxSequences
from hydpy.models.llake.llake_states import StateSequences
from hydpy.models.llake.llake_inlets import InletSequences
from hydpy.models.llake.llake_outlets import OutletSequences
from hydpy.models.llake.llake_aides import AideSequences
from hydpy.models.llake.llake_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_aides.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class QA(sequencetools.AideSequence):
    """Seeausfluss (outflow from the lake) [m³/s]."""
    NDIM, NUMERIC = 0, False


class VQ(sequencetools.AideSequence):
    """Hilfsterm (auxiliary term) [m³]."""
    NDIM, NUMERIC = 0, False


class V(sequencetools.AideSequence):
    """Wasservolumen (water volume) [m³]."""
    NDIM, NUMERIC = 0, False


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of HydPy-L-Lake."""
    _SEQCLASSES = (QA, VQ, V)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools
from hydpy.core import timetools
from hydpy.core import objecttools


class N(parametertools.SingleParameter):
    """Anzahl Interpolationsstützstellen (number of nodes for the
    interpolation between water state, volume and discharge) [-].

    Parameter |N| determines the length of all 1- and 2-dimensional
    parameters of HydPy-L-Lake.  This requires that the value of
    the respective |N| instance is set before any of the values
    of these 1- and 2-dimensional parameters are set.  Changing the
    value of the |N| instance necessitates setting their values
    again.

    Examples:

        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> n(5)

        For "simple" 1-dimensional parameters, the shape depends on the
        value of |N| only:

        >>> w.shape
        (5,)

        For time varying parameters (derived from |SeasonalParameter|),
        it also depends on the defined number simulation steps per leap year:

        >>> verzw.shape
        (732,)
        >>> q.shape
        (732, 5)
    """
    NDIM, TYPE, TIME, SPAN = 0, int, None, (2, None)

    def __call__(self, *args, **kwargs):
        """The prefered way to pass a value to |N| instances
        within parameter control files.  Sets the shape of the associated
        1- and 2-dimensional parameter objects additionally.
        """
        parametertools.SingleParameter.__call__(self, *args, **kwargs)
        for subpars in self.subpars.pars.model.parameters:
            for par in subpars:
                if par.name == 'toy':
                    continue
                elif par.NDIM == 1:
                    if isinstance(par, parametertools.SeasonalParameter):
                        par.shape = (None,)
                    else:
                        par.shape = self.value
                elif ((par.NDIM == 2) and
                      isinstance(par, parametertools.SeasonalParameter)):
                    par.shape = (None, self.value)


class W(parametertools.MultiParameter):
    """Wasserstand (water stage) [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class V(parametertools.MultiParameter):
    """Wasservolumen bei vorgegebenem Wasserstand (water volume for a
    given water stage) [m³]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class Q(parametertools.SeasonalParameter):
    """Üblicher Seeausfluss bei vorgegebenem Wasserstand (sea outlet discharge
    for a given water stage) [m³/s]."""
    NDIM, TYPE, TIME, SPAN = 2, float, None, (0., None)


class MaxDT(parametertools.SingleParameter):
    """Maximale interne Rechenschrittweite (maximum of the internal step size)
    [T].

    Examples:

        Initialize a llake model and set different time step length for
        parameterstep, simulationstep and maxdt:

        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> maxdt('1h')

        Internally, the value of maxdt is stored in seconds, but in string
        representations it is shown as a |Period| string:

        >>> maxdt.value
        3600.0
        >>> maxdt
        maxdt('1h')

        Note that maxdt only defines the maximum internal step size, not the
        one actually used.  Hence, maxdt is e.g. allowed to be larger than the
        actual simulation step size:

        >>> maxdt('2d')
        >>> maxdt
        maxdt('2d')

        It is allowed the set the number of seconds directly or modify it
        by mathematical operations:

        >>> maxdt.value = 60.
        >>> maxdt
        maxdt('1m')
        >>> maxdt *= 120.
        >>> maxdt
        maxdt('2h')

        However, for the more secure way of calling the object trying to
        pass an argument which cannot be converted to a Period instance
        unambiguously results in an exception:

        >>> maxdt(60.)
        Traceback (most recent call last):
        ...
        ValueError: While trying the set the value of parameter `maxdt` of \
the lake model handled by element `?`, the following error occured: \
The supplied argument must be either an instance of `datetime.timedelta` \
or `str`.  The given arguments type is float. (An example: set `max dt` to \
3600 seconds by writing `maxdt("1h"))
    """
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def __call__(self, *args, **kwargs):
        try:
            args = [timetools.Period(args[0]).seconds]
        except BaseException:
            objecttools.augment_excmessage(
                'While trying the set the value of parameter `maxdt` '
                'of the lake model handled by element `%s`'
                % objecttools.devicename(self),
                '(An example: set `max dt` to 3600 seconds by writing '
                '`maxdt("1h"))')
        parametertools.SingleParameter.__call__(self, *args, **kwargs)

    def __repr__(self):
        try:
            return "%s('%s')" % (self.name,
                                 str(timetools.Period.fromseconds(self.value)))
        except BaseException:
            return '%s(?)' % self.name


class MaxDW(parametertools.SeasonalParameter):
    """Maximale Absenkgeschwindigkeit (maximum drop in water level) [m/T]."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)


class Verzw(parametertools.SeasonalParameter):
    """Zu- oder Abschlag des Seeausflusses (addition to or abstraction from
    the seas outlet discharge) [m³/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-L-Lake, directly defined by the user."""
    _PARCLASSES = (N, W, V, Q, MaxDT, MaxDW, Verzw)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy import pub
from hydpy.core import parametertools


class TOY(parametertools.IndexParameter):
    """References the "global" time of the year index array [-]."""
    NDIM, TYPE, TIME, SPAN = 1, int, None, (0, None)

    def update(self):
        self.setreference(pub.indexer.timeofyear)


class Seconds(parametertools.SingleParameter):
    """Length of the actual simulation step size in seconds [s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        self.value = self.simulationstep.seconds


class NmbSubsteps(parametertools.SingleParameter):
    """Number of the internal simulation steps [-].

    Examples:

        Initialize a llake model and assume a simulation step size of 12 hours:

        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')

        If the maximum internal step size is also set to 12 hours, there is
        only one internal calculation step per outer simulation step:

        >>> maxdt('12h')
        >>> derived.nmbsubsteps.update()
        >>> derived.nmbsubsteps
        nmbsubsteps(1)

        Assigning smaller values to `maxdt` increases `nmbstepsize`:

        >>> maxdt('1h')
        >>> derived.nmbsubsteps.update()
        >>> derived.nmbsubsteps
        nmbsubsteps(12)

        In case the simulationstep is not a whole multiple of `dwmax`,
        the value of `nmbsubsteps` is rounded up:

        >>> maxdt('59m')
        >>> derived.nmbsubsteps.update()
        >>> derived.nmbsubsteps
        nmbsubsteps(13)

        Even for `maxdt` values exceeding the simulationstep, the value
        of `numbsubsteps` does not become smaller than one:

        >>> maxdt('2d')
        >>> derived.nmbsubsteps.update()
        >>> derived.nmbsubsteps
        nmbsubsteps(1)
    """
    NDIM, TYPE, TIME, SPAN = 0, int, None, (1, None)

    def update(self):
        maxdt = self.subpars.pars.control.maxdt
        seconds = self.simulationstep.seconds
        self.value = numpy.ceil(seconds/maxdt)


class VQ(parametertools.SeasonalParameter):
    """Hilfsterm (auxiliary term): math:VdtQ = 2 \\cdot + dt \\cdot Q` [m³].

    >>> from hydpy.models.llake import *
    >>> parameterstep('1d')
    >>> simulationstep('12h')
    >>> n(3)
    >>> v(0., 1e5, 1e6)
    >>> q(_1=[0., 1., 2.], _7=[0., 2., 5.])
    >>> maxdt('12h')
    >>> derived.seconds.update()
    >>> derived.nmbsubsteps.update()
    >>> derived.vq.update()
    >>> derived.vq
    vq(toy_1_1_0_0_0=[0.0, 243200.0, 2086400.0],
       toy_7_1_0_0_0=[0.0, 286400.0, 2216000.0])
    """
    NDIM, TYPE, TIME, SPAN = 2, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        der = self.subpars
        for (toy, qs) in con.q:
            setattr(self, str(toy), 2.*con.v+der.seconds/der.nmbsubsteps*qs)
        self.refresh()


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-L-Lake, indirectly defined by the user."""
    _PARCLASSES = (TOY, Seconds, NmbSubsteps, VQ)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class QZ(sequencetools.FluxSequence):
    """Seezufluss (inflow into the lake) [m³/s]."""
    NDIM, NUMERIC = 0, False


class QA(sequencetools.FluxSequence):
    """Seeausfluss (outflow from the lake) [m³/s]."""
    NDIM, NUMERIC = 0, False


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-L-Lake."""
    _SEQCLASSES = (QZ, QA)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_inlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Abfluss (runoff) [m³/s]."""
    NDIM, NUMERIC = 1, False


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-L-Lake."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
# -*- coding: utf-8 -*-

# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools


def solve_dv_dt_v1(self):
    """Solve the differential equation of HydPy-L.

    At the moment, HydPy-L only implements a simple numerical solution of
    its underlying ordinary differential equation.  To increase the accuracy
    (or sometimes even to prevent instability) of this approximation, one
    can set the value of parameter |MaxDT| to a value smaller than the actual
    simulation step size.  Method |solve_dv_dt_v1| then applies the methods
    related to the numerical approximation multiple times and aggregates
    the results.

    Note that the order of convergence is one only.  It is hard to tell how
    short the internal simulation step needs to be to ensure a certain degree
    of accuracy.  In most cases one hour or very often even one day should be
    sufficient to gain acceptable results.  However, this strongly depends on
    the given water stage-volume-discharge relationship.  Hence it seems
    advisable to always define a few test waves and apply the llake model with
    different |MaxDT| values.  Afterwards, select a |MaxDT| value  lower than
    one which results in acceptable approximations for all test waves.  The
    computation time of the llake mode per substep is rather small, so always
    include a safety factor.

    Of course, an adaptive step size determination would be much more
    convenient...

    Required derived parameter:
      |NmbSubsteps|

    Used aide sequence:
      |llake_aides.V|
      |llake_aides.QA|

    Updated state sequence:
      |llake_states.V|

    Calculated flux sequence:
      |llake_fluxes.QA|

    Note that method |solve_dv_dt_v1| calls the versions of `calc_vq`,
    `interp_qa` and `calc_v_qa` selected by the respective application model.
    Hence, also their parameter and sequence specifications need to be
    considered.

    Basic equation:
      :math:`\\frac{dV}{dt}= QZ - QA(V)`
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    aid = self.sequences.aides.fastaccess
    flu.qa = 0.
    aid.v = old.v
    for i in range(der.nmbsubsteps):
        self.calc_vq()
        self.interp_qa()
        self.calc_v_qa()
        flu.qa += aid.qa
    flu.qa /= der.nmbsubsteps
    new.v = aid.v


def calc_vq_v1(self):
    """Calculate the auxiliary term.

    Required derived parameters:
      |Seconds|
      |NmbSubsteps|

    Required flux sequence:
      |QZ|

    Required aide sequence:
      |llake_aides.V|

    Calculated aide sequence:
      |llake_aides.VQ|

    Basic equation:
      :math:`VQ = 2 \\cdot V + \\frac{Seconds}{NmbSubsteps} \\cdot QZ`

    Example:

        The following example shows that the auxiliary term `vq` does not
        depend on the (outer) simulation step size but on the (inner)
        calculation step size defined by parameter `maxdt`:

        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> maxdt('6h')
        >>> derived.seconds.update()
        >>> derived.nmbsubsteps.update()
        >>> fluxes.qz = 2.
        >>> aides.v = 1e5
        >>> model.calc_vq_v1()
        >>> aides.vq
        vq(243200.0)
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    aid.vq = 2.*aid.v+der.seconds/der.nmbsubsteps*flu.qz


def interp_qa_v1(self):
    """Calculate the lake outflow based on linear interpolation.

    Required control parameters:
      |N|
      |llake_control.Q|

    Required derived parameters:
      |llake_derived.TOY|
      |llake_derived.VQ|

    Required aide sequence:
      |llake_aides.VQ|

    Calculated aide sequence:
      |llake_aides.QA|

    Examples:

        In preparation for the following examples, define a short simulation
        time period with a simulation step size of 12 hours and initialize
        the required model object:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
        ...                                    '2000.01.04',
        ...                                    '12h'))
        >>> from hydpy.models.llake import *
        >>> parameterstep()

        Next, for the sake of brevity, define a test function:

        >>> def test(*vqs):
        ...     for vq in vqs:
        ...         aides.vq(vq)
        ...         model.interp_qa_v1()
        ...         print(repr(aides.vq), repr(aides.qa))

        The following three relationships between the auxiliary term `vq` and
        the tabulated discharge `q` are taken as examples.  Each one is valid
        for one of the first three days in January and is defined via five
        nodes:

        >>> n(5)
        >>> derived.toy.update()
        >>> derived.vq(_1_1_6=[0., 1., 2., 2., 3.],
        ...            _1_2_6=[0., 1., 2., 2., 3.],
        ...            _1_3_6=[0., 1., 2., 3., 4.])
        >>> q(_1_1_6=[0., 0., 0., 0., 0.],
        ...   _1_2_6=[0., 2., 5., 6., 9.],
        ...   _1_3_6=[0., 2., 1., 3., 2.])

        In the first example, discharge does not depend on the actual value
        of the auxiliary term and is always zero:

        >>> model.idx_sim = pub.timegrids.init['2000.01.01']
        >>> test(0., .75, 1., 4./3., 2., 7./3., 3., 10./3.)
        vq(0.0) qa(0.0)
        vq(0.75) qa(0.0)
        vq(1.0) qa(0.0)
        vq(1.333333) qa(0.0)
        vq(2.0) qa(0.0)
        vq(2.333333) qa(0.0)
        vq(3.0) qa(0.0)
        vq(3.333333) qa(0.0)

        The seconds example demonstrates that relationships are allowed to
        contain jumps, which is the case for the (`vq`,`q`) pairs (2,6) and
        (2,7).  Also it demonstrates that when the highest `vq` value is
        exceeded linear extrapolation based on the two highest (`vq`,`q`)
        pairs is performed:

        >>> model.idx_sim = pub.timegrids.init['2000.01.02']
        >>> test(0., .75, 1., 4./3., 2., 7./3., 3., 10./3.)
        vq(0.0) qa(0.0)
        vq(0.75) qa(1.5)
        vq(1.0) qa(2.0)
        vq(1.333333) qa(3.0)
        vq(2.0) qa(5.0)
        vq(2.333333) qa(7.0)
        vq(3.0) qa(9.0)
        vq(3.333333) qa(10.0)

        The third example shows that the relationships do not need to be
        arranged monotonously increasing.  Particualarly for the extrapolation
        range, this could result in negative values of `qa`, which is avoided
        by setting it to zero in such cases:

        >>> model.idx_sim = pub.timegrids.init['2000.01.03']
        >>> test(.5, 1.5, 2.5, 3.5, 4.5, 10.)
        vq(0.5) qa(1.0)
        vq(1.5) qa(1.5)
        vq(2.5) qa(2.0)
        vq(3.5) qa(2.5)
        vq(4.5) qa(1.5)
        vq(10.0) qa(0.0)

    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    aid = self.sequences.aides.fastaccess
    idx = der.toy[self.idx_sim]
    for jdx in range(1, con.n):
        if der.vq[idx, jdx] >= aid.vq:
            break
    aid.qa = ((aid.vq-der.vq[idx, jdx-1]) *
              (con.q[idx, jdx]-con.q[idx, jdx-1]) /
              (der.vq[idx, jdx]-der.vq[idx, jdx-1]) +
              con.q[idx, jdx-1])
    aid.qa = max(aid.qa, 0.)


def calc_v_qa_v1(self):
    """Update the stored water volume based on the equation of continuity.

    Note that for too high outflow values, which would result in overdraining
    the lake, the outflow is trimmed.

    Required derived parameters:
      |Seconds|
      |NmbSubsteps|

    Required flux sequence:
      |QZ|

    Updated aide sequences:
      |llake_aides.QA|
      |llake_aides.V|

    Basic Equation:
      :math:`\\frac{dV}{dt}= QZ - QA`

    Examples:

        Prepare a lake model with an initial storage of 100.000 m³ and an
        inflow of 2 m³/s and a (potential) outflow of 6 m³/s:

        >>> from hydpy.models.llake import *
        >>> parameterstep()
        >>> simulationstep('12h')
        >>> maxdt('6h')
        >>> derived.seconds.update()
        >>> derived.nmbsubsteps.update()
        >>> aides.v = 1e5
        >>> fluxes.qz = 2.
        >>> aides.qa = 6.

        Through calling method `calc_v_qa_v1` three times with the same inflow
        and outflow values, the storage is emptied after the second step and
        outflow is equal to inflow after the third step:

        >>> model.calc_v_qa_v1()
        >>> aides.v
        v(13600.0)
        >>> aides.qa
        qa(6.0)
        >>> model.new2old()
        >>> model.calc_v_qa_v1()
        >>> aides.v
        v(0.0)
        >>> aides.qa
        qa(2.62963)
        >>> model.new2old()
        >>> model.calc_v_qa_v1()
        >>> aides.v
        v(0.0)
        >>> aides.qa
        qa(2.0)

        Note that the results of method |calc_v_qa_v1| are not based
        depend on the (outer) simulation step size but on the (inner)
        calculation step size defined by parameter `maxdt`.
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    aid.qa = min(aid.qa, flu.qz+der.nmbsubsteps/der.seconds*aid.v)
    aid.v = max(aid.v+der.seconds/der.nmbsubsteps*(flu.qz-aid.qa), 0.)


def interp_w_v1(self):
    """Calculate the actual water stage based on linear interpolation.

    Required control parameters:
      |N|
      |llake_control.V|
      |llake_control.W|

    Required state sequence:
      |llake_states.V|

    Calculated state sequence:
      |llake_states.W|

    Examples:

        Prepare a model object:

        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')

        For the sake of brevity, define a test function:

        >>> def test(*vs):
        ...     for v in vs:
        ...         states.v.new = v
        ...         model.interp_w_v1()
        ...         print(repr(states.v), repr(states.w))

        Define a simple `w`-`v` relationship consisting of three nodes and
        calculate the water stages for different volumes:

        >>> n(3)
        >>> v(0., 2., 4.)
        >>> w(-1., 1., 2.)

        Perform the interpolation for a few test points:

        >>> test(0., .5, 2., 3., 4., 5.)
        v(0.0) w(-1.0)
        v(0.5) w(-0.5)
        v(2.0) w(1.0)
        v(3.0) w(1.5)
        v(4.0) w(2.0)
        v(5.0) w(2.5)

        The reference water stage of the relationship can be selected
        arbitrarily.  Even negative water stages are returned, as is
        demonstrated by the first two calculations.  For volumes outside
        the range of the (`v`,`w`) pairs, the outer two highest pairs are
        used for linear extrapolation.
    """
    con = self.parameters.control.fastaccess
    new = self.sequences.states.fastaccess_new
    for jdx in range(1, con.n):
        if con.v[jdx] >= new.v:
            break
    new.w = ((new.v-con.v[jdx-1]) *
             (con.w[jdx]-con.w[jdx-1]) /
             (con.v[jdx]-con.v[jdx-1]) +
             con.w[jdx-1])


def interp_v_v1(self):
    """Calculate the actual water volume based on linear interpolation.

    Required control parameters:
      |N|
      |llake_control.V|
      |llake_control.W|

    Required state sequence:
      |llake_states.W|

    Calculated state sequence:
      |llake_states.V|

    Examples:

        Prepare a model object:

        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')

        For the sake of brevity, define a test function:

        >>> def test(*ws):
        ...     for w in ws:
        ...         states.w.new = w
        ...         model.interp_v_v1()
        ...         print(repr(states.w), repr(states.v))

        Define a simple `v`-`w` relationship consisting of three nodes and
        calculate the water stages for different volumes:

        >>> n(3)
        >>> w(-1., 1., 2.)
        >>> v(0., 2., 4.)

        Perform the interpolation for a few test points:

        >>> test(-1., -.5, 1., 1.5, 2., 2.5)
        w(-1.0) v(0.0)
        w(-0.5) v(0.5)
        w(1.0) v(2.0)
        w(1.5) v(3.0)
        w(2.0) v(4.0)
        w(2.5) v(5.0)

        The reference water stage of the relationship can be selected
        arbitrarily, hence even the negative water contained in the given
        example is allowed.  For volumes outside the range of the (`w`,`v`)
        pairs, the outer two highest pairs are used for linear extrapolation.
    """
    con = self.parameters.control.fastaccess
    new = self.sequences.states.fastaccess_new
    for jdx in range(1, con.n):
        if con.w[jdx] >= new.w:
            break
    new.v = ((new.w-con.w[jdx-1]) *
             (con.v[jdx]-con.v[jdx-1]) /
             (con.w[jdx]-con.w[jdx-1]) +
             con.v[jdx-1])


def corr_dw_v1(self):
    """Adjust the water stage drop to the highest value allowed and correct
    the associated fluxes.

    Note that method |corr_dw_v1| calls the method `interp_v` of the
    respective application model.  Hence the requirements of the actual
    `interp_v` need to be considered additionally.

    Required control parameter:
      |MaxDW|

    Required derived parameters:
      |llake_derived.TOY|
      |Seconds|

    Required flux sequence:
      |QZ|

    Updated flux sequence:
      |llake_fluxes.QA|

    Updated state sequences:
      |llake_states.W|
      |llake_states.V|

    Basic Restriction:
      :math:`W_{old} - W_{new} \\leq MaxDW`

    Examples:

        In preparation for the following examples, define a short simulation
        time period with a simulation step size of 12 hours and initialize
        the required model object:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
        ...                                    '2000.01.04',
        ...                                    '12h'))
        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> derived.toy.update()
        >>> derived.seconds.update()

        Select the first half of the second day of January as the simulation
        step relevant for the following examples:

        >>> model.idx_sim = pub.timegrids.init['2000.01.02']

        The following tests are based on method |interp_v_v1| for the
        interpolation of the stored water volume based on the corrected
        water stage:

        >>> model.interp_v = model.interp_v_v1

        For the sake of simplicity, the underlying `w`-`v` relationship is
        assumed to be linear:

        >>> n(2.)
        >>> w(0., 1.)
        >>> v(0., 1e6)

        The maximum drop in water stage for the first half of the second
        day of January is set to 0.4 m/d.  Note that, due to the difference
        between the parameter step size and the simulation step size, the
        actual value used for calculation is 0.2 m/12h:

        >>> maxdw(_1_1_18=.1,
        ...       _1_2_6=.4,
        ...       _1_2_18=.1)
        >>> maxdw
        maxdw(toy_1_1_18_0_0=0.1,
              toy_1_2_6_0_0=0.4,
              toy_1_2_18_0_0=0.1)
        >>> from hydpy import round_
        >>> round_(maxdw.value[2])
        0.2

        Define old and new water stages and volumes in agreement with the
        given linear relationship:

        >>> states.w.old = 1.
        >>> states.v.old = 1e6
        >>> states.w.new = .9
        >>> states.v.new = 9e5

        Also define an inflow and an outflow value.  Note the that the latter
        is set to zero, which is inconsistent with the actual water stage drop
        defined above, but done for didactic reasons:

        >>> fluxes.qz = 1.
        >>> fluxes.qa = 0.

        Calling the |corr_dw_v1| method does not change the values of
        either of following sequences, as the actual drop (0.1 m/12h) is
        smaller than the allowed drop (0.2 m/12h):

        >>> model.corr_dw_v1()
        >>> states.w
        w(0.9)
        >>> states.v
        v(900000.0)
        >>> fluxes.qa
        qa(0.0)

        Note that the values given above are not recalculated, which can
        clearly be seen for the lake outflow, which is still zero.

        Through setting the new value of the water stage to 0.6 m, the actual
        drop (0.4 m/12h) exceeds the allowed drop (0.2 m/12h). Hence the
        water stage is trimmed and the other values are recalculated:

        >>> states.w.new = .6
        >>> model.corr_dw_v1()
        >>> states.w
        w(0.8)
        >>> states.v
        v(800000.0)
        >>> fluxes.qa
        qa(5.62963)

        Through setting the maximum water stage drop to zero, method
        |corr_dw_v1| is effectively disabled.  Regardless of the actual
        change in water stage, no trimming or recalculating is performed:

        >>> maxdw.toy_01_02_06 = 0.
        >>> states.w.new = .6
        >>> model.corr_dw_v1()
        >>> states.w
        w(0.6)
        >>> states.v
        v(800000.0)
        >>> fluxes.qa
        qa(5.62963)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    idx = der.toy[self.idx_sim]
    if (con.maxdw[idx] > 0.) and ((old.w-new.w) > con.maxdw[idx]):
        new.w = old.w-con.maxdw[idx]
        self.interp_v()
        flu.qa = flu.qz+(old.v-new.v)/der.seconds


def modify_qa_v1(self):
    """Add water to or remove water from the calculated lake outflow.

    Required control parameter:
      |Verzw|

    Required derived parameter:
      |llake_derived.TOY|

    Updated flux sequence:
      |llake_fluxes.QA|

    Basic Equation:
      :math:`QA = QA* - Verzw`

    Examples:
        In preparation for the following examples, define a short simulation
        time period with a simulation step size of 12 hours and initialize
        the required model object:

        >>> from hydpy import pub
        >>> from hydpy import Timegrids, Timegrid
        >>> pub.timegrids = Timegrids(Timegrid('2000.01.01',
        ...                                    '2000.01.04',
        ...                                    '12h'))
        >>> from hydpy.models.llake import *
        >>> parameterstep('1d')
        >>> derived.toy.update()

        Select the first half of the second day of January as the simulation
        step relevant for the following examples:

        >>> model.idx_sim = pub.timegrids.init['2000.01.02']

        Assume that, in accordance with previous calculations, the original
        outflow value is 3 m³/s:

        >>> fluxes.qa = 3.

        Prepare the shape of parameter `verzw` (usually, this is done
        automatically when calling parameter `n`):
        >>> verzw.shape = (None,)

        Set the value of the abstraction on the first half of the second
        day of January to 2 m³/s:

        >>> verzw(_1_1_18=0.,
        ...       _1_2_6=2.,
        ...       _1_2_18=0.)

        In the first example `verzw` is simply subtracted from `qa`:

        >>> model.modify_qa_v1()
        >>> fluxes.qa
        qa(1.0)

        In the second example `verzw` exceeds `qa`, resulting in a zero
        outflow value:

        >>> model.modify_qa_v1()
        >>> fluxes.qa
        qa(0.0)

        The last example demonstrates, that "negative abstractions" are
        allowed, resulting in an increase in simulated outflow:

        >>> verzw.toy_1_2_6 = -2.
        >>> model.modify_qa_v1()
        >>> fluxes.qa
        qa(2.0)
    """

    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    idx = der.toy[self.idx_sim]
    flu.qa = max(flu.qa-con.verzw[idx], 0.)


def pick_q_v1(self):
    """Update the inlet link sequence."""
    flu = self.sequences.fluxes.fastaccess
    inl = self.sequences.inlets.fastaccess
    flu.qz = 0.
    for idx in range(inl.len_q):
        flu.qz += inl.q[idx][0]


def pass_q_v1(self):
    """Update the outlet link sequence."""
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += flu.qa


class Model(modeltools.Model):
    """Base model for HydPy-L-Lake."""

    _INLET_METHODS = (pick_q_v1,)
    _RUN_METHODS = (solve_dv_dt_v1,
                    interp_w_v1,
                    corr_dw_v1,
                    modify_qa_v1,)
    _ADD_METHODS = (interp_v_v1,
                    calc_vq_v1,
                    interp_qa_v1,
                    calc_v_qa_v1)
    _OUTLET_METHODS = (pass_q_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Abfluss (runoff) [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-L-Lake."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/llake/llake_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class V(sequencetools.StateSequence):
    """Wasservolumen (water volume) [m³]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class W(sequencetools.StateSequence):
    """Wasserstand (water stage) [m]."""
    NDIM, NUMERIC, SPAN = 0, False, (None, None)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-L-Lake."""
    _SEQCLASSES = (V, W)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
# -*- coding: utf-8 -*-
"""
The L-Land model is the core of the HydPy implementation of the
LARSIM model.  It consists of routines for the preparation
of meteorological input, the calculation of potential evaporation,
the simulation of water stored on plants, in the snow layer and in the
soil, as well as runoff concentration.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from lland
from hydpy.models.lland.lland_constants import (
    SIED_D, SIED_L, VERS, ACKER, WEINB, OBSTB, BODEN, GLETS, GRUE_I, FEUCHT,
    GRUE_E, BAUMB, NADELW, LAUBW, MISCHW, WASSER, FLUSS, SEE)
from hydpy.models.lland.lland_control import ControlParameters
from hydpy.models.lland.lland_derived import DerivedParameters
from hydpy.models.lland.lland_inputs import InputSequences
from hydpy.models.lland.lland_fluxes import FluxSequences
from hydpy.models.lland.lland_states import StateSequences
from hydpy.models.lland.lland_logs import LogSequences
from hydpy.models.lland.lland_aides import AideSequences
from hydpy.models.lland.lland_outlets import OutletSequences
from hydpy.models.lland.lland_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_aides.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class SfA(sequencetools.AideSequence):
    """Sättigungsflächen-Aktivität (activity of the saturated surface) [mm]."""
    NDIM, NUMERIC = 1, False


class Exz(sequencetools.AideSequence):
    """Bodenfeuchteüberschuss (excess of soil water) [mm]."""
    NDIM, NUMERIC = 1, False


class BVl(sequencetools.AideSequence):
    """Berechneter Bodenwasserverlust (calculated amount of water that should
    be released from the soil) [mm]."""
    NDIM, NUMERIC = 1, False


class MVl(sequencetools.AideSequence):
    """Möglicher Bodenwasserverlust (maximum amount of water released that can
    be released from the soil) [mm]."""
    NDIM, NUMERIC = 1, False


class RVl(sequencetools.AideSequence):
    """Relation von MVl und BVl (ratio of MVl and BVl) [-]."""
    NDIM, NUMERIC = 1, False


class EPW(sequencetools.AideSequence):
    """Potenzielle Evaporation/Evapotranspiration von Wasserflächen (potential
    evaporation/evapotranspiration combined from all water areas) [mm]."""
    NDIM, NUMERIC = 0, False


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of the HydPy-L-Land model."""
    _SEQCLASSES = (SfA,
                   Exz,
                   BVl,
                   MVl,
                   RVl,
                   EPW)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_constants.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
# -*- coding: utf-8 -*-
"""The HydPy-L-Land model (|lland|) allows for the subdivision of subbasins
into hydrological response units (hru).  Some processes, e.g. interception,
are calculated separately for each zone.  This is why some parameters (e.g.
the usable field capacity |NFk|) and some sequences (e.g. the actual soil
water storage |BoWa|) are 1-dimensional.  Each entry represents the value
of a different hru.

In contrasts to the original LARSIM model, the HydPy-L-Land model allows for
arbitrary definitions of units.  Nevertheless, the original distinction
in accordance with sixteen different landuse types is still supported.  The
parameter |Lnk| defines which entry of e.g. parameter |NFk| is related to
which land use type via integer values.  Note that for the units of the most
land use types, the same equations are applied. Only units of type |VERS|,
|WASSER|, |FLUSS|, and |SEE| are partly connected to different process
equations.

For comprehensibility, this module introduces the relevant integer constants.
Through performing a wildcard import

>>> from hydpy.models.lland import *

these are available in your local namespace:

>>> (SIED_D, SIED_L, VERS, ACKER, WEINB, OBSTB, BODEN, GLETS, GRUE_I,
...  FEUCHT, GRUE_E, BAUMB, NADELW, LAUBW, MISCHW, WASSER, FLUSS, SEE)
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
"""
from hydpy.core import parametertools

SIED_D = parametertools.IntConstant(1)
"""Constant for `Siedlung, dicht` (settlement, dense)."""
SIED_L = parametertools.IntConstant(2)
"""Constant for `Siedlung, locker` (settlement, light)."""
VERS = parametertools.IntConstant(3)
"""Constant for `versiegelt` (sealed)."""
ACKER = parametertools.IntConstant(4)
"""Constant for `Acker` (fields)."""
WEINB = parametertools.IntConstant(5)
"""Constant for `Weinbau` (viniculture)."""
OBSTB = parametertools.IntConstant(6)
"""Constant for `Obstbau` (intensive orchards)."""
BODEN = parametertools.IntConstant(7)
"""Constant for `unbewachsener Boden` (unsealed soil, not overgrown)."""
GLETS = parametertools.IntConstant(8)
"""Constant for `Gletscher` (`glacier`)."""
GRUE_I = parametertools.IntConstant(9)
"""Constant for `Grünland, intensiv` (intensive pasture)."""
FEUCHT = parametertools.IntConstant(10)
"""Constant for `Feuchtflächen` (wetlands)."""
GRUE_E = parametertools.IntConstant(11)
"""Constant for `Grünland, extensiv` (extensive pasture)."""
BAUMB = parametertools.IntConstant(12)
"""Constant for `lockerer Baumbestand` (sparsely populated forest)."""
NADELW = parametertools.IntConstant(13)
"""Constant for `Nadelwald` (coniferous forest)."""
LAUBW = parametertools.IntConstant(14)
"""Constant for `Laubwald` (deciduous forest)."""
MISCHW = parametertools.IntConstant(15)
"""Constant for `Mischwald` (mixed forest)."""
WASSER = parametertools.IntConstant(16)
"""Constant for `Wasser` (water areas)."""
FLUSS = parametertools.IntConstant(17)
"""Constant for `Fluss` (river surface)."""
SEE = parametertools.IntConstant(18)
"""Constant for `See` (lake surface)."""

CONSTANTS = parametertools.Constants()
"""Dictionary containing all constants defined by HydPy-L-Land."""

# Make only the constants available on wildcard-imports.
__all__ = list(CONSTANTS.keys())

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
import warnings
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import abctools
from hydpy.core import parametertools
from hydpy.core import objecttools
from hydpy.core import timetools
# ...model specific
from hydpy.models.lland import lland_constants
from hydpy.models.lland import lland_parameters


class FT(parametertools.SingleParameter):
    """Teileinzugsgebietsfläche (subbasin area) [km²]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (1e-10, None)


class NHRU(parametertools.SingleParameter):
    """Anzahl der Hydrotope (number of hydrological response units) [-].

    Note that |NHRU| determines the length of most 1-dimensional HydPy-L-Land
    parameters and sequences as well the shape of 2-dimensional log sequences
    with a predefined length of one axis (see |WET0|).  This required that
    the value of the respective |NHRU| instance is set before any of the
    values of these 1-dimensional parameters or sequences are set.  Changing
    the value of the |NHRU| instance necessitates setting their values again.

    Examples:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(5)
        >>> control.kg.shape
        (5,)
        >>> fluxes.tkor.shape
        (5,)
        >>> logs.wet0.shape
        (1, 5)
    """
    NDIM, TYPE, TIME, SPAN = 0, int, None, (1, None)

    def __call__(self, *args, **kwargs):
        parametertools.SingleParameter.__call__(self, *args, **kwargs)
        for subpars in self.subpars.pars.model.parameters:
            for par in subpars:
                if par.NDIM == 1:
                    par.shape = self.value
        for subseqs in self.subpars.pars.model.sequences:
            for seq in subseqs:
                if (((seq.NDIM == 1) and (seq.name != 'moy')) or
                    ((seq.NDIM == 2) and
                     isinstance(seq, abctools.LogSequenceABC))):
                    seq.shape = self.value


class FHRU(lland_parameters.MultiParameter):
    """Flächenanteile der Hydrotope (area percentages of the respective
    HRUs) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., 1.)


class Lnk(lland_parameters.MultiParameter):
    """Landnutzungsklasse (land use class) [-].

    For increasing legibility, the HydPy-L-Land constants are used for string
    representions of |Lnk| instances:

    >>> from hydpy.models.lland import *
    >>> parameterstep('1d')
    >>> nhru(4)
    >>> lnk(ACKER, ACKER, WASSER, MISCHW)
    >>> lnk.values
    array([ 4,  4, 16, 15])
    >>> lnk
    lnk(ACKER, ACKER, WASSER, MISCHW)
    """
    NDIM, TYPE, TIME = 1, int, None
    SPAN = (min(lland_constants.CONSTANTS.values()),
            max(lland_constants.CONSTANTS.values()))

    def compress_repr(self):
        """Returns a list which contains a string representation with land
        uses being defined by the constants |SIED_D|, |SIED_L|...
        """
        invmap = {value: key for key, value in
                  lland_constants.CONSTANTS.items()}
        return [', '.join(invmap.get(value, repr(value))
                          for value in self.values)]


class HNN(lland_parameters.MultiParameter):
    """Höhe über Normal-Null (height above sea level) [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)


class KG(lland_parameters.MultiParameter):
    """Niederschlagskorrekturfaktor (adjustment factor for precipitation)
    [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)
    INIT = 1.


class KT(lland_parameters.MultiParameter):
    """Temperaturkorrektursummand (adjustment summand for air temperature)
    [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)
    INIT = 0.


class KE(lland_parameters.MultiParameter):
    """Grasreferenzverdunstungskorrekturfaktor (adjustment factor for
    reference evapotranspiration) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)
    INIT = 1.


class KF(lland_parameters.MultiParameter):
    """Küstenfaktor ("coast factor" of Turc-Wendling's evaporation equation
    [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (.6, 1.)
    INIT = 1.


class WfET0(lland_parameters.MultiParameter):
    """Zeitlicher Wichtungsfaktor der Grasreferenzverdunsung (temporal
    weighting factor for reference evapotranspiration)."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., 1.)


class FLn(lland_parameters.LanduseMonthParameter):
    """Landnutzungsabhängiger Verdunstungsfaktor (factor for adjusting
    reference evapotranspiration to different land use classes) [-]."""
    NDIM, TYPE, TIME, SPAN = 2, float, None, (0., None)
    INIT = 1.


class HInz(parametertools.SingleParameter):
    """Interzeptionskapazität bezogen auf die Blattoberfläche (interception
    capacity normalized to the leaf surface area) [mm]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = .2


class LAI(lland_parameters.LanduseMonthParameter):
    """Blattflächenindex (leaf area index) [-]."""
    NDIM, TYPE, TIME, SPAN = 2, float, None, (0., None)
    INIT = 5.


class TRefT(lland_parameters.MultiParameterLand):
    """Lufttemperaturgrenzwert des grundlegenden Grad-Tag-Verfahrens
    (air temperature threshold of the degree-day method) [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)
    INIT = 0.


class TRefN(lland_parameters.MultiParameterLand):
    """Niederschlagstemperaturgrenzwert des erweiterten Grad-Tag-Verfahrens
    (precipitation temperature threshold of the degree-day method) [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)
    INIT = 0.


class TGr(lland_parameters.MultiParameterLand):
    """Temperaturgrenzwert flüssiger/fester Niederschlag (threshold
    temperature liquid/frozen precipitation) [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, None)
    INIT = 0.


class TSp(lland_parameters.MultiParameterLand):
    """Temperaturspanne flüssiger/fester Niederschlag (temperature range
    with mixed precipitation) [°C]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)
    INIT = 0.


class GTF(lland_parameters.MultiParameterLand):
    """Grad-Tag-Faktor (factor of the degree-day method) [mm/°C/T]."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)
    INIT = 3.


class RSchmelz(parametertools.SingleParameter):
    """Spezifische Schmelzwärme von Wasser (specific melt heat of water)
    [J/g]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 334.


class CPWasser(parametertools.SingleParameter):
    """Spezifische Wärmekapazität von Wasser (specific heat capacity of water)
    [J/g]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 4.1868


class PWMax(lland_parameters.MultiParameterLand):
    """Maximalverhältnis Gesamt- zu Trockenschnee (maximum ratio of the
    total and the frozen water equivalent stored in the snow cover) [-].

    In addition to the |parametertools| call method, it
    is possible to set the value of parameter |PWMax| in accordance to
    the keyword arguments `rhot0` and `rhodkrit`.

    Basic Equation:
        :math:`PWMax = \\frac{1.474 \\cdot rhodkrit}
        {rhot0 + 0.474 \\cdot rhodkrit}`

    Example:

        Using the common values for both `rhot0` and `rhodkrit`...

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> nhru(1)
        >>> lnk(ACKER)
        >>> pwmax(rhot0=0.2345, rhodkrit=0.42)

        ...results in:

        >>> pwmax
        pwmax(1.427833)

        This is also the default value of |PWMax|, meaning the relative
        portion of liquid water in the snow cover cannot exceed 30 %.

        Additional error messages try to clarify how to pass parameters:

        >>> pwmax(rhot0=0.2345)
        Traceback (most recent call last):
        ...
        ValueError: For the calculating parameter `pwmax`, both keyword \
arguments `rhot0` and `rhodkrit` are required.

        >>> pwmax(rho_t_0=0.2345)
        Traceback (most recent call last):
        ...
        ValueError: Parameter `pwmax` can be set by directly passing a \
single value or a list of values, by assigning single values to landuse \
keywords, or by calculating a value based on the keyword arguments \
`rhot0` and `rhodkrit`.

        Passing landuse specific parameter values is also supported
        (but not in combination with `rhot0` and `rhodkrit`):

        >>> pwmax(acker=2.0, vers=3.0)
        >>> pwmax
        pwmax(2.0)

        The "normal" input error management still works:

        >>> pwmax()
        Traceback (most recent call last):
        ...
        ValueError: For parameter pwmax of element ? neither a positional \
nor a keyword argument is given.
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (1., None)
    INIT = 1.4278333871488538

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |PWMax| instances
        within parameter control files.
        """
        rhot0 = float(kwargs.pop('rhot0', numpy.nan))
        rhodkrit = float(kwargs.pop('rhodkrit', numpy.nan))
        missing = int(numpy.isnan(rhot0)) + int(numpy.isnan(rhodkrit))
        try:
            lland_parameters.MultiParameterLand.__call__(self, *args, **kwargs)
            return
        except NotImplementedError:
            pass
        except BaseException as exc:
            if missing == 2:
                raise exc
        if not missing:
            self(1.474*rhodkrit/(rhot0+0.474*rhodkrit))
        elif missing == 1:
            raise ValueError(
                'For the calculating parameter `pwmax`, both keyword '
                'arguments `rhot0` and `rhodkrit` are required.')
        else:
            raise ValueError(
                'Parameter `pwmax` can be set by directly passing a '
                'single value or a list of values, by assigning single '
                'values to landuse keywords, or by calculating a value '
                'based on the keyword arguments `rhot0` and `rhodkrit`.')


class GrasRef_R(parametertools.SingleParameter):
    """Bodenfeuchte-Verdunstung-Parameter (soil moisture-dependent
    evaporation factor) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 5.


class NFk(lland_parameters.MultiParameterSoil):
    """Nutzbare Feldkapazität (usable field capacity) [mm]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)
    INIT = 100.


class RelWZ(lland_parameters.MultiParameterSoil):
    """Relative Mindestbodenfeuchte für die Interflowentstehung (threshold
       value of relative soil moisture for interflow generation) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (None, 1.)
    INIT = .8

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(3)
        >>> relwb.values = .5
        >>> relwz(0.2, .5, .8)
        >>> relwz
        relwz(0.5, 0.5, 0.8)
        """
        relwb = self.subpars.relwb.value
        if (lower is None) and (relwb is not None):
            lower = relwb
        lland_parameters.MultiParameterSoil.trim(self, lower, upper)


class RelWB(lland_parameters.MultiParameterSoil):
    """Relative Mindestbodenfeuchte für die Basisabflussentstehung (threshold
       value of relative soil moisture for base flow generation) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)
    INIT = .05

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with :math:`RelWB \\leq RelWZ`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(3)
        >>> relwz.values = .5
        >>> relwb(0.2, .5, .8)
        >>> relwb
        relwb(0.2, 0.5, 0.5)
        """
        relwz = self.subpars.relwz.value
        if (upper is None) and (relwz is not None):
            upper = relwz
        lland_parameters.MultiParameterSoil.trim(self, lower, upper)


class Beta(lland_parameters.MultiParameterSoil):
    """Drainageindex des tiefen Bodenspeichers (storage coefficient for
    releasing base flow from the lower soil compartment) [1/T]."""
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)
    INIT = .01


class FBeta(lland_parameters.MultiParameterSoil):
    """Faktor zur Erhöhung der Perkolation im Grobporenbereich (factor for
    increasing percolation under wet conditions) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (1., None)
    INIT = 1.


class DMin(lland_parameters.MultiParameterSoil):
    """Drainageindex des mittleren Bodenspeichers (flux rate for
    releasing interflow from the middle soil compartment) [mm/T].

    In addition to the |MultiParameterSoil| call method,
    it is possible to set the value of parameter |DMin| in accordance
    to the keyword argument `r_dmin` due to compatibility reasons with the
    original LARSIM implemetation.

    Basic Equation:
        :math:`Dmin = 0.024192 \\cdot r_dmin`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(1)
        >>> lnk(ACKER)
        >>> dmax(10.) # to prevent trimming of dmin, see below
        >>> dmin(r_dmin=10.0)
        >>> dmin
        dmin(0.24192)

        Note the additional dependence of the parameter value on the
        relation between the `parameterstep` and the actual `simulationstep`:

        >>> dmin.values
        array([ 0.12096])

        A wrong keyword results in the right answer:

        >>> dmin(rdmin=10.0)
        Traceback (most recent call last):
        ...
        NotImplementedError: The value(s) of parameter dmin of element ? \
could not be set based on the given keyword arguments.

    """
    NDIM, TYPE, TIME, SPAN = 1, float, True, (0., None)
    INIT = 0.

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |DMin| instances
        within parameter control files.
        """
        try:
            lland_parameters.MultiParameterSoil.__call__(self, *args, **kwargs)
        except NotImplementedError:
            args = kwargs.get('r_dmin')
            if args is not None:
                self.values = 0.024192*self.apply_timefactor(numpy.array(args))
                self.trim()
            else:
                objecttools.augment_excmessage()

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with :math:`DMin \\leq DMax`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(5)
        >>> dmax.values = 2.
        >>> dmin(-2., 0., 2., 4., 6.)
        >>> dmin
        dmin(0.0, 0.0, 2.0, 4.0, 4.0)
        """
        if upper is None:
            upper = self.subpars.dmax
        lland_parameters.MultiParameterSoil.trim(self, lower, upper)


class DMax(lland_parameters.MultiParameterSoil):
    """Drainageindex des oberen Bodenspeichers (additional flux rate for
    releasing interflow from the upper soil compartment) [mm/T].

    In addition to the |MultiParameterSoil| call method,
    it is possible to set the value of parameter |DMax| in accordance
    to the keyword argument `r_dmax` due to compatibility reasons with the
    original LARSIM implemetation.

    Basic Equation:
        :math:`Dmax = 2.4192 \\cdot r_dmax`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(1)
        >>> lnk(ACKER)
        >>> dmin(0.) # to prevent trimming of dmax, see below
        >>> dmax(r_dmax=10.0)
        >>> dmax
        dmax(24.192)

        Note the additional dependence of the parameter value on the
        relation between the `parameterstep` and the actual `simulationstep`:

        >>> dmax.values
        array([ 12.096])

        A wrong keyword results in the right answer:

        >>> dmax(rdmax=10.0)
        Traceback (most recent call last):
        ...
        NotImplementedError: The value(s) of parameter dmax of element ? \
could not be set based on the given keyword arguments.

    """
    NDIM, TYPE, TIME, SPAN = 1, float, True, (None, None)
    INIT = 1.

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |DMax| instances
        within parameter control files.
        """
        try:
            lland_parameters.MultiParameterSoil.__call__(self, *args, **kwargs)
        except NotImplementedError:
            args = kwargs.get('r_dmax')
            if args is not None:
                self.values = 2.4192*self.apply_timefactor(numpy.array(args))
                self.trim()
            else:
                objecttools.augment_excmessage()

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with :math:`DMax \\geq DMin`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(3)
        >>> dmin.values = 2.
        >>> dmax(2., 4., 6.)
        >>> dmax
        dmax(4.0, 4.0, 6.0)
        """
        if lower is None:
            lower = self.subpars.dmin
        lland_parameters.MultiParameterSoil.trim(self, lower, upper)


class BSf(lland_parameters.MultiParameterSoil):
    """Bodenfeuchte-Sättigungsfläche-Parameter (shape parameter for the
    relation between the avarage soil moisture and the relative saturated
    area of a subbasin) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)
    INIT = .4


class A1(parametertools.SingleParameter):
    """Parameter für die kontinuierliche Aufteilung der
    Direktabflusskomponenten (threshold value for the continuous seperation
    of direct runoff in a slow and a fast component) [mm/d]
    """
    NDIM, TYPE, TIME, SPAN = 0, float, True, (0., None)
    INIT = numpy.inf


class A2(parametertools.SingleParameter):
    """Parameter für die diskontinuierliche Aufteilung der
    Direktabflusskomponenten (threshold value for the discontinuous seperation
    of direct runoff in a slow and a fast component) [mm/d]
    """
    NDIM, TYPE, TIME, SPAN = 0, float, True, (0., None)
    INIT = 0.


class TInd(parametertools.SingleParameter):
    """Fließzeitindex (factor related to the time of concentration) [T].

    In addition to the |SingleParameter| call method, it
    is possible to set the value of parameter |TInd| in accordance to
    the keyword arguments `tal` (talweg, [km]), `hot` (higher reference
    altitude, [m]), and `hut` (lower reference altitude, [m]).  This is
    supposed to decrease the time of runoff concentration in small and/or
    steep catchments.  Note that |TInd| does not only affect direct
    runoff, but interflow and base flow as well.  Hence it seems advisable
    to use this regionalization strategy with caution.

    Basic Equation:
        :math:`TInd[h] = (0.868 \\cdot \\frac{Tal^3}{HOT-HUT})^{0.385}`

    Examples:

        Using typical values:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> tind(tal=5.0, hot=210.0, hut=200.0)
        >>> tind
        tind(0.104335)

        Note that this result is related to the selected parameter step size
        of one day.  The value related to the selected simulation step size
        of 12 hours is:

        >>> from hydpy import round_
        >>> round_(tind.value)
        0.20867

        Unplausible input values lead to the following exceptions:

        >>> tind(tal=5.0, hot=200.0, hut=200.0)
        Traceback (most recent call last):
        ...
        ValueError: For the alternative calculation of parameter `tind`, \
the value assigned to keyword argument `tal` must be greater then zero and \
the one of `hot` must be greater than the one of `hut`.  However, for \
element ?, the values `5.0`, `200.0` and `200.0` were given respectively.

        >>> tind(tal=0.0, hot=210.0, hut=200.0)
        Traceback (most recent call last):
        ...
        ValueError: For the alternative calculation of parameter `tind`, \
the value assigned to keyword argument `tal` must be greater then zero and \
the one of `hot` must be greater than the one of `hut`.  However, for \
element ?, the values `0.0`, `210.0` and `200.0` were given respectively.

        However, it is hard to define exact bounds for the value of
        |TInd| itself.  Whenever it is below 0.001 or above 1000 days,
        the following warning is given:

        >>> tind(tal=0.001, hot=210.0, hut=200.0)
        Traceback (most recent call last):
        ...
        UserWarning: Due to the given values for the keyword arguments \
`tal` (0.001), `hot` (210.0) and `hut` (200.0), parameter `tind` of \
element `?` has been set to an unrealistic value of `0.000134 hours`.

        Additionally, exceptions for missing (or wrong) keywords are
        implemented

        >>> tind(tal=5.0, hot=210.0)
        Traceback (most recent call last):
        ...
        ValueError: For the alternative calculation of parameter `tind`, \
values for all three keyword keyword arguments `tal`, `hot`, and `hut` \
must be given.

    """
    NDIM, TYPE, TIME, SPAN = 0, float, False, (0., None)
    INIT = 1.

    def __call__(self, *args, **kwargs):
        """The prefered way to pass values to |TInd| instances
        within parameter control files.
        """
        try:
            parametertools.SingleParameter.__call__(self, *args, **kwargs)
        except NotImplementedError:
            try:
                tal = float(kwargs['tal'])
                hot = float(kwargs['hot'])
                hut = float(kwargs['hut'])
            except KeyError:
                raise ValueError(
                    'For the alternative calculation of parameter `tind`, '
                    'values for all three keyword keyword arguments `tal`, '
                    '`hot`, and `hut` must be given.')
            if (tal <= 0.) or (hot <= hut):
                raise ValueError(
                    'For the alternative calculation of parameter '
                    '`tind`, the value assigned to keyword argument '
                    '`tal` must be greater then zero and the one of '
                    '`hot` must be greater than the one of `hut`.  '
                    'However, for element %s, the values `%s`, `%s` '
                    'and `%s` were given respectively.'
                    % (objecttools.devicename(self), tal, hot, hut))
            self.value = (.868*tal**3/(hot-hut))**.385
            if (self > 1000.) or (self < .001):
                warnings.warn(
                    'Due to the given values for the keyword arguments '
                    '`tal` (%s), `hot` (%s) and `hut` (%s), parameter '
                    '`tind` of element `%s` has been set to an '
                    'unrealistic value of `%s hours`.'
                    % (tal, hot, hut, objecttools.devicename(self),
                       objecttools.repr_(self.value)))
            self.value *= timetools.Period('1h')/self.simulationstep


class EQB(parametertools.SingleParameter):
    """Kalibrierfaktor für die Basisabflusskonzentration (factor for adjusting
    the concentration time of baseflow). [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 5000.

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with :math:`EQI1 \\leq EQB`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> eqi1.value = 2.
        >>> eqb(1.)
        >>> eqb
        eqb(2.0)
        >>> eqb(2.)
        >>> eqb
        eqb(2.0)
        >>> eqb(3.)
        >>> eqb
        eqb(3.0)
        """
        if lower is None:
            lower = self.subpars.eqi1
        parametertools.SingleParameter.trim(self, lower, upper)


class EQI1(parametertools.SingleParameter):
    """Kalibrierfaktor für die "untere" Zwischenabflusskonzentration
    (factor for adjusting the concentration time of the first interflow
    component) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 2000.

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with
        :math:`EQI2 \\leq EQI1 \\leq EQB`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> eqb.value = 3.
        >>> eqi2.value = 1.
        >>> eqi1(0.)
        >>> eqi1
        eqi1(1.0)
        >>> eqi1(1.)
        >>> eqi1
        eqi1(1.0)
        >>> eqi1(2.)
        >>> eqi1
        eqi1(2.0)
        >>> eqi1(3.)
        >>> eqi1
        eqi1(3.0)
        >>> eqi1(4.)
        >>> eqi1
        eqi1(3.0)
        """
        if lower is None:
            lower = self.subpars.eqi2
        if upper is None:
            upper = self.subpars.eqb
        parametertools.SingleParameter.trim(self, lower, upper)


class EQI2(parametertools.SingleParameter):
    """Kalibrierfaktor für die "obere" Zwischenabflusskonzentration
    (factor for adjusting the concentration time of the second interflow
    component) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 1000.

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with
        :math:`EQD \\leq EQI2 \\leq EQI1`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> eqi1.value = 3.
        >>> eqd1.value = 1.
        >>> eqi2(0.)
        >>> eqi2
        eqi2(1.0)
        >>> eqi2(1.)
        >>> eqi2
        eqi2(1.0)
        >>> eqi2(2.)
        >>> eqi2
        eqi2(2.0)
        >>> eqi2(3.)
        >>> eqi2
        eqi2(3.0)
        >>> eqi2(4.)
        >>> eqi2
        eqi2(3.0)
        """
        if lower is None:
            lower = self.subpars.eqd1
        if upper is None:
            upper = self.subpars.eqi1
        parametertools.SingleParameter.trim(self, lower, upper)


class EQD1(parametertools.SingleParameter):
    """Kalibrierfaktor für die langsamere Direktabflusskonzentration (factor
    for adjusting the concentration time of the slower component of direct
    runoff). [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 100.

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with
        :math:`EQD2 \\leq EQD1 \\leq EQI2`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> eqi2.value = 3.
        >>> eqd2.value = 1.
        >>> eqd1(0.)
        >>> eqd1
        eqd1(1.0)
        >>> eqd1(1.)
        >>> eqd1
        eqd1(1.0)
        >>> eqd1(2.)
        >>> eqd1
        eqd1(2.0)
        >>> eqd1(3.)
        >>> eqd1
        eqd1(3.0)
        >>> eqd1(4.)
        >>> eqd1
        eqd1(3.0)
        """
        if lower is None:
            lower = self.subpars.eqd2
        if upper is None:
            upper = self.subpars.eqi2
        parametertools.SingleParameter.trim(self, lower, upper)


class EQD2(parametertools.SingleParameter):
    """Kalibrierfaktor für die schnellere Direktabflusskonzentration (factor
    for adjusting the concentration time of the faster component of direct
    runoff). [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 50.

    def trim(self, lower=None, upper=None):
        """Trim upper values in accordance with
        :math:`EQD2 \\leq EQD1`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> eqd1.value = 3.
        >>> eqd2(2.)
        >>> eqd2
        eqd2(2.0)
        >>> eqd2(3.)
        >>> eqd2
        eqd2(3.0)
        >>> eqd2(4.)
        >>> eqd2
        eqd2(3.0)
        """
        if upper is None:
            upper = self.subpars.eqd1
        parametertools.SingleParameter.trim(self, lower, upper)


class NegQ(parametertools.SingleParameter):
    """Option: sind negative Abflüsse erlaubt (flag that indicated wether
    negative discharge values are allowed or not) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, bool, None, (0., None)
    INIT = False


class ControlParameters(parametertools.SubParameters):
    """Control parameters of HydPy-L-Land, directly defined by the user."""
    _PARCLASSES = (FT,
                   NHRU,
                   Lnk,
                   FHRU,
                   HNN,
                   KG,
                   KT,
                   KE,
                   KF,
                   WfET0,
                   FLn,
                   HInz,
                   LAI,
                   TRefT,
                   TRefN,
                   TGr,
                   TSp,
                   GTF,
                   RSchmelz,
                   CPWasser,
                   PWMax,
                   GrasRef_R,
                   NFk,
                   RelWZ,
                   RelWB,
                   Beta,
                   FBeta,
                   DMax,
                   DMin,
                   BSf,
                   A1,
                   A2,
                   TInd,
                   EQB,
                   EQI1,
                   EQI2,
                   EQD1,
                   EQD2,
                   NegQ)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy import pub
from hydpy.core import parametertools
# ...model specific
from hydpy.models.lland import lland_parameters


class MOY(parametertools.IndexParameter):
    """References the "global" month of the year index array [-]."""
    NDIM, TYPE, TIME, SPAN = 1, int, None, (0, 11)

    def update(self):
        self.setreference(pub.indexer.monthofyear)


class KInz(lland_parameters.LanduseMonthParameter):
    """Interzeptionskapazität bezogen auf die Bodenoberfläche (interception
    capacity normalized to the soil surface area) [mm]."""
    NDIM, TYPE, TIME, SPAN = 2, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.hinz*con.lai)


class WB(lland_parameters.MultiParameter):
    """Absolute Mindestbodenfeuchte für die Basisabflussentstehung (threshold
       value of absolute soil moisture for base flow generation) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.relwb*con.nfk)


class WZ(lland_parameters.MultiParameter):
    """Absolute Mindestbodenfeuchte für die Interflowentstehung (threshold
       value of absolute soil moisture for interflow generation) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.relwz*con.nfk)


class KB(parametertools.SingleParameter):
    """Konzentrationszeit des Basisabflusses (concentration time of baseflow)
    [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.eqb*con.tind)


class KI1(parametertools.SingleParameter):
    """Konzentrationszeit des "unteren" Zwischenabflusses (concentration time
    of the first interflow component) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.eqi1*con.tind)


class KI2(parametertools.SingleParameter):
    """Konzentrationszeit des "oberen" Zwischenabflusses" (concentration time
    of the second interflow component) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.eqi2*con.tind)


class KD1(parametertools.SingleParameter):
    """Konzentrationszeit des "langsamen" Direktabflusses (concentration time
    of the slower component of direct runoff) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.eqd1*con.tind)


class KD2(parametertools.SingleParameter):
    """Konzentrationszeit des "schnellen" Direktabflusses (concentration time
    of the faster component of direct runoff) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.eqd2*con.tind)


class QFactor(parametertools.SingleParameter):
    """Factor for converting mm/stepsize to m³/s."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        con = self.subpars.pars.control
        self(con.ft*1000./self.simulationstep.seconds)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-H-Land, indirectly defined by the user."""
    _PARCLASSES = (MOY,
                   KInz,
                   WB,
                   WZ,
                   KB,
                   KI1,
                   KI2,
                   KD1,
                   KD2,
                   QFactor)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class NKor(sequencetools.FluxSequence):
    """Korrigierter Niederschlag (corrected precipitation) [mm]."""
    NDIM, NUMERIC = 1, False


class TKor(sequencetools.FluxSequence):
    """Korrigierte Lufttemperatur (corrected air temperature) [°C]."""
    NDIM, NUMERIC = 1, False


class ET0(sequencetools.FluxSequence):
    """Grasreferenzverdunstung (reference evapotranspiration) [mm]."""
    NDIM, NUMERIC = 1, False


class EvPo(sequencetools.FluxSequence):
    """Potenzielle Evaporation/Evapotranspiration (potential
    evaporation/evapotranspiration) [mm]."""
    NDIM, NUMERIC = 1, False


class NBes(sequencetools.FluxSequence):
    """Gesamter Bestandsniederschlag (total stand precipitation) [mm]."""
    NDIM, NUMERIC = 1, False


class SBes(sequencetools.FluxSequence):
    """Schneeanteil Bestandsniederschlag (frozen stand precipitation) [mm]."""
    NDIM, NUMERIC = 1, False


class EvI(sequencetools.FluxSequence):
    """Tatsächliche Interzeptionsverdunstung (actual evaporation of
    intercepted water) [mm]."""
    NDIM, NUMERIC = 1, False


class EvB(sequencetools.FluxSequence):
    """Tatsächliche Bodenverdunstung (actual evaporation of
    soil water) [mm]."""
    NDIM, NUMERIC = 1, False


class WGTF(sequencetools.FluxSequence):
    """Potenzielle Schneeschmelze (maximum amount of frozen water that could
    be melted) [mm]."""
    NDIM, NUMERIC = 1, False


class Schm(sequencetools.FluxSequence):
    """Tatsächliche Schneeschmelze (actual amount of water melting within the
    snow cover) [mm]."""
    NDIM, NUMERIC = 1, False


class WaDa(sequencetools.FluxSequence):
    """Wasserdargebot (water reaching the soil routine) [mm]."""
    NDIM, NUMERIC = 1, False


class QDB(sequencetools.FluxSequence):
    """Direktabfluss-Abgabe aus dem Bodenspeicher (direct runoff release
    from the soil storage) [mm]."""
    NDIM, NUMERIC = 1, False


class QIB1(sequencetools.FluxSequence):
    """Erste Komponente der Interflow-Abgabe aus dem Bodenspeicher (first
    component of the interflow release from the soil storage) [mm]."""
    NDIM, NUMERIC = 1, False


class QIB2(sequencetools.FluxSequence):
    """Zweite Komponente der Interflow-Abgabe aus dem Bodenspeicher (second
    component of the interflow release from the soil storage) [mm]."""
    NDIM, NUMERIC = 1, False


class QBB(sequencetools.FluxSequence):
    """Basisabfluss-Abgabe aus dem Bodenspeicher (base flow release
    from the soil storage) [mm]."""
    NDIM, NUMERIC = 1, False


class QDGZ(sequencetools.FluxSequence):
    """Gesamtzufluss in beide Direktabfluss-Gebietsspeicher (total inflow
    into both storage compartments for direct runoff) [mm]."""
    NDIM, NUMERIC = 0, False


class Q(sequencetools.FluxSequence):
    """Gesamtabfluss des Teilgebiets (runoff at the catchment outlet) [mm]."""
    NDIM, NUMERIC = 0, False


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of the HydPy-L-Land model."""
    _SEQCLASSES = (NKor,
                   TKor,
                   ET0,
                   EvPo,
                   SBes,
                   NBes,
                   EvI,
                   EvB,
                   WGTF,
                   Schm,
                   WaDa,
                   QDB,
                   QIB1,
                   QIB2,
                   QBB,
                   QDGZ,
                   Q)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_inputs.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Nied(sequencetools.InputSequence):
    """Niederschlag (precipitation) [mm]."""
    NDIM, NUMERIC = 0, False


class TemL(sequencetools.InputSequence):
    """Lufttemperatur (air temperature) [°C]."""
    NDIM, NUMERIC = 0, False


class Glob(sequencetools.InputSequence):
    """Globalstrahlung (global radiation) [W/m²]."""
    NDIM, NUMERIC = 0, False


class PET(sequencetools.InputSequence):
    """Potenzielle Verdunstung (potential evapotranspiration) [mm]."""
    NDIM, NUMERIC = 0, False


class InputSequences(sequencetools.InputSequences):
    """Input sequences of the HydPy-L-Land model."""
    _SEQCLASSES = (Nied,
                   TemL,
                   Glob,
                   PET)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_logs.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class WET0(sequencetools.LogSequence):
    """Zeitlich gewichtete Grasreferenzverdunstung (temporally weighted
    reference evapotranspiration) [mm].

    Log sequence |WET0| is generally initialized with a length of one
    on the first axis:

    >>> from hydpy.models.lland import *
    >>> parameterstep()
    >>> logs.wet0.shape = 3
    >>> logs.wet0.shape
    (1, 3)
    """
    NDIM, NUMERIC = 2, False

    def _setshape(self, shape):
        sequencetools.LogSequence._setshape(self, (1, shape))

    shape = property(sequencetools.LogSequence._getshape, _setshape)


class LogSequences(sequencetools.LogSequences):
    """Log sequences of the HydPy-L-Land model."""
    _SEQCLASSES = (WET0,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
960  
961  
962  
963  
964  
965  
966  
967  
968  
969  
970  
971  
972  
973  
974  
975  
976  
977  
978  
979  
980  
981  
982  
983  
984  
985  
986  
987  
988  
989  
990  
991  
992  
993  
994  
995  
996  
997  
998  
999  
1000  
1001  
1002  
1003  
1004  
1005  
1006  
1007  
1008  
1009  
1010  
1011  
1012  
1013  
1014  
1015  
1016  
1017  
1018  
1019  
1020  
1021  
1022  
1023  
1024  
1025  
1026  
1027  
1028  
1029  
1030  
1031  
1032  
1033  
1034  
1035  
1036  
1037  
1038  
1039  
1040  
1041  
1042  
1043  
1044  
1045  
1046  
1047  
1048  
1049  
1050  
1051  
1052  
1053  
1054  
1055  
1056  
1057  
1058  
1059  
1060  
1061  
1062  
1063  
1064  
1065  
1066  
1067  
1068  
1069  
1070  
1071  
1072  
1073  
1074  
1075  
1076  
1077  
1078  
1079  
1080  
1081  
1082  
1083  
1084  
1085  
1086  
1087  
1088  
1089  
1090  
1091  
1092  
1093  
1094  
1095  
1096  
1097  
1098  
1099  
1100  
1101  
1102  
1103  
1104  
1105  
1106  
1107  
1108  
1109  
1110  
1111  
1112  
1113  
1114  
1115  
1116  
1117  
1118  
1119  
1120  
1121  
1122  
1123  
1124  
1125  
1126  
1127  
1128  
1129  
1130  
1131  
1132  
1133  
1134  
1135  
1136  
1137  
1138  
1139  
1140  
1141  
1142  
1143  
1144  
1145  
1146  
1147  
1148  
1149  
1150  
1151  
1152  
1153  
1154  
1155  
1156  
1157  
1158  
1159  
1160  
1161  
1162  
1163  
1164  
1165  
1166  
1167  
1168  
1169  
1170  
1171  
1172  
1173  
1174  
1175  
1176  
1177  
1178  
1179  
1180  
1181  
1182  
1183  
1184  
1185  
1186  
1187  
1188  
1189  
1190  
1191  
1192  
1193  
1194  
1195  
1196  
1197  
1198  
1199  
1200  
1201  
1202  
1203  
1204  
1205  
1206  
1207  
1208  
1209  
1210  
1211  
1212  
1213  
1214  
1215  
1216  
1217  
1218  
1219  
1220  
1221  
1222  
1223  
1224  
1225  
1226  
1227  
1228  
1229  
1230  
1231  
1232  
1233  
1234  
1235  
1236  
1237  
1238  
1239  
1240  
1241  
1242  
1243  
1244  
1245  
1246  
1247  
1248  
1249  
1250  
1251  
1252  
1253  
1254  
1255  
1256  
1257  
1258  
1259  
1260  
1261  
1262  
1263  
1264  
1265  
1266  
1267  
1268  
1269  
1270  
1271  
1272  
1273  
1274  
1275  
1276  
1277  
1278  
1279  
1280  
1281  
1282  
1283  
1284  
1285  
1286  
1287  
1288  
1289  
1290  
1291  
1292  
1293  
1294  
1295  
1296  
1297  
1298  
1299  
1300  
1301  
1302  
1303  
1304  
1305  
1306  
1307  
1308  
1309  
1310  
1311  
1312  
1313  
1314  
1315  
1316  
1317  
1318  
1319  
1320  
1321  
1322  
1323  
1324  
1325  
1326  
1327  
1328  
1329  
1330  
1331  
1332  
1333  
1334  
1335  
1336  
1337  
1338  
1339  
1340  
1341  
1342  
1343  
1344  
1345  
1346  
1347  
1348  
1349  
1350  
1351  
1352  
1353  
1354  
1355  
1356  
1357  
1358  
1359  
1360  
1361  
1362  
1363  
1364  
1365  
1366  
1367  
1368  
1369  
1370  
1371  
1372  
1373  
1374  
1375  
1376  
1377  
1378  
1379  
1380  
1381  
1382  
1383  
1384  
1385  
1386  
1387  
1388  
1389  
1390  
1391  
1392  
1393  
1394  
1395  
1396  
1397  
1398  
1399  
1400  
1401  
1402  
1403  
1404  
1405  
1406  
1407  
1408  
1409  
1410  
1411  
1412  
1413  
1414  
1415  
1416  
1417  
1418  
1419  
1420  
1421  
1422  
1423  
1424  
1425  
1426  
1427  
1428  
1429  
1430  
1431  
1432  
1433  
1434  
1435  
1436  
1437  
1438  
1439  
1440  
1441  
1442  
1443  
1444  
1445  
1446  
1447  
1448  
1449  
1450  
1451  
1452  
1453  
1454  
1455  
1456  
1457  
1458  
1459  
1460  
1461  
1462  
1463  
1464  
1465  
1466  
1467  
1468  
1469  
1470  
1471  
1472  
1473  
1474  
1475  
1476  
1477  
1478  
1479  
1480  
1481  
1482  
1483  
1484  
1485  
1486  
1487  
1488  
1489  
1490  
1491  
1492  
1493  
1494  
1495  
1496  
1497  
1498  
1499  
1500  
1501  
1502  
1503  
1504  
1505  
1506  
1507  
1508  
1509  
1510  
1511  
1512  
1513  
1514  
1515  
1516  
1517  
1518  
1519  
1520  
1521  
1522  
1523  
1524  
1525  
1526  
1527  
1528  
1529  
1530  
1531  
1532  
1533  
1534  
1535  
1536  
1537  
1538  
1539  
1540  
1541  
1542  
1543  
1544  
1545  
1546  
1547  
1548  
1549  
1550  
1551  
1552  
1553  
1554  
1555  
1556  
1557  
1558  
1559  
1560  
1561  
1562  
1563  
1564  
1565  
1566  
1567  
1568  
1569  
1570  
1571  
1572  
1573  
1574  
1575  
1576  
1577  
1578  
1579  
1580  
1581  
1582  
1583  
1584  
1585  
1586  
1587  
1588  
1589  
1590  
1591  
1592  
1593  
1594  
1595  
1596  
1597  
1598  
1599  
1600  
1601  
1602  
1603  
1604  
1605  
1606  
1607  
1608  
1609  
1610  
1611  
1612  
1613  
1614  
1615  
1616  
1617  
1618  
1619  
1620  
1621  
1622  
1623  
1624  
1625  
1626  
1627  
1628  
1629  
1630  
1631  
1632  
1633  
1634  
1635  
1636  
1637  
1638  
1639  
1640  
1641  
1642  
1643  
1644  
1645  
1646  
1647  
1648  
1649  
1650  
1651  
1652  
1653  
1654  
1655  
1656  
1657  
1658  
1659  
1660  
1661  
1662  
1663  
1664  
1665  
1666  
1667  
1668  
1669  
1670  
1671  
1672  
1673  
1674  
1675  
1676  
1677  
1678  
1679  
1680  
1681  
1682  
1683  
1684  
1685  
1686  
1687  
1688  
1689  
1690  
1691  
1692  
1693  
1694  
1695  
1696  
1697  
1698  
1699  
1700  
1701  
1702  
1703  
1704  
1705  
1706  
1707  
1708  
1709  
1710  
1711  
1712  
1713  
1714  
1715  
1716  
1717  
1718  
1719  
1720  
1721  
1722  
1723  
1724  
1725  
1726  
1727  
1728  
1729  
1730  
1731  
1732  
1733  
1734  
1735  
1736  
1737  
1738  
1739  
1740  
1741  
1742  
1743  
1744  
1745  
1746  
1747  
1748  
1749  
1750  
1751  
1752  
1753  
1754  
1755  
1756  
1757  
1758  
1759  
1760  
1761  
1762  
1763  
1764  
1765  
1766  
1767  
1768  
1769  
1770  
1771  
1772  
1773  
1774  
1775  
1776  
1777  
1778  
1779  
1780  
1781  
1782  
1783  
1784  
1785  
1786  
1787  
1788  
1789  
1790  
1791  
1792  
1793  
1794  
1795  
1796  
1797  
1798  
1799  
1800  
1801  
1802  
1803  
1804  
1805  
1806  
1807  
1808  
1809  
1810  
1811  
1812  
1813  
1814  
1815  
1816  
1817  
1818  
1819  
1820  
1821  
1822  
1823  
1824  
1825  
1826  
1827  
1828  
1829  
1830  
1831  
1832  
1833  
1834  
1835  
1836  
1837  
1838  
1839  
1840  
1841  
1842  
1843  
1844  
1845  
1846  
1847  
1848  
1849  
1850  
1851  
1852  
1853  
1854  
1855  
1856  
1857  
1858  
1859  
1860  
1861  
1862  
1863  
1864  
1865  
1866  
1867  
1868  
1869  
1870  
1871  
1872  
1873  
1874  
1875  
1876  
1877  
1878  
1879  
1880  
1881  
1882  
1883  
1884  
1885  
1886  
1887  
1888  
1889  
1890  
1891  
1892  
1893  
1894  
1895  
1896  
1897  
1898  
1899  
1900  
1901  
1902  
1903  
1904  
1905  
1906  
1907  
1908  
1909  
1910  
1911  
1912  
1913  
1914  
1915  
1916  
1917  
1918  
1919  
1920  
1921  
1922  
1923  
1924  
1925  
1926  
1927  
1928  
1929  
1930  
1931  
1932  
1933  
1934  
1935  
1936  
1937  
1938  
1939  
1940  
1941  
1942  
1943  
1944  
1945  
1946  
1947  
1948  
1949  
1950  
1951  
1952  
1953  
1954  
1955  
1956  
1957  
1958  
1959  
1960  
1961  
1962  
1963  
1964  
1965  
1966  
1967  
1968  
1969  
1970  
1971  
1972  
1973  
1974  
1975  
1976  
1977  
1978  
1979  
1980  
1981  
1982  
1983  
1984  
1985  
1986  
1987  
1988  
1989  
1990  
1991  
1992  
1993  
1994  
1995  
1996  
1997  
1998  
1999  
2000  
2001  
2002  
2003  
2004  
2005  
2006  
2007  
2008  
2009  
2010  
2011  
2012  
2013  
2014  
2015  
2016  
2017  
2018  
2019  
2020  
2021  
2022  
2023  
2024  
2025  
2026  
2027  
2028  
2029  
2030  
2031  
2032  
2033  
2034  
2035  
2036  
2037  
2038  
2039  
2040  
2041  
2042  
2043  
2044  
2045  
2046  
2047  
2048  
2049  
2050  
2051  
2052  
2053  
2054  
2055  
2056  
2057  
2058  
2059  
2060  
# -*- coding: utf-8 -*-

# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools
from hydpy.cythons import modelutils
# ...model specifc
from hydpy.models.lland.lland_constants import WASSER, FLUSS, SEE, VERS


def calc_nkor_v1(self):
    """Adjust the given precipitation values.

    Required control parameters:
      |NHRU|
      |KG|

    Required input sequence:
      |Nied|

    Calculated flux sequence:
      |NKor|

    Basic equation:
      :math:`NKor = KG \\cdot Nied`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(3)
        >>> kg(0.8, 1.0, 1.2)
        >>> inputs.nied = 10.
        >>> model.calc_nkor_v1()
        >>> fluxes.nkor
        nkor(8.0, 10.0, 12.0)
    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nhru):
        flu.nkor[k] = con.kg[k] * inp.nied


def calc_tkor_v1(self):
    """Adjust the given air temperature values.

    Required control parameters:
      |NHRU|
      |KT|

    Required input sequence:
      |TemL|

    Calculated flux sequence:
      |TKor|

    Basic equation:
      :math:`TKor = KT + TemL`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(3)
        >>> kt(-2.0, 0.0, 2.0)
        >>> inputs.teml(1.)
        >>> model.calc_tkor_v1()
        >>> fluxes.tkor
        tkor(-1.0, 1.0, 3.0)
    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nhru):
        flu.tkor[k] = con.kt[k] + inp.teml


def calc_et0_v1(self):
    """Calculate reference evapotranspiration after Turc-Wendling.

    Required control parameters:
      |NHRU|
      |KE|
      |KF|
      |HNN|

    Required input sequence:
      |Glob|

    Required flux sequence:
      |TKor|

    Calculated flux sequence:
      |ET0|

    Basic equation:
      :math:`ET0 = KE \\cdot
      \\frac{(8.64 \\cdot Glob+93 \\cdot KF) \\cdot (TKor+22)}
      {165 \\cdot (TKor+123) \\cdot (1 + 0.00019 \\cdot min(HNN, 600))}`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(3)
        >>> ke(1.1)
        >>> kf(0.6)
        >>> hnn(200.0, 600.0, 1000.0)
        >>> inputs.glob = 200.0
        >>> fluxes.tkor = 15.0
        >>> model.calc_et0_v1()
        >>> fluxes.et0
        et0(3.07171, 2.86215, 2.86215)
    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nhru):
        flu.et0[k] = (con.ke[k]*(((8.64*inp.glob+93.*con.kf[k]) *
                                  (flu.tkor[k]+22.)) /
                                 (165.*(flu.tkor[k]+123.) *
                                  (1.+0.00019*min(con.hnn[k], 600.)))))


def calc_et0_wet0_v1(self):
    """Correct the given reference evapotranspiration and update the
    corresponding log sequence.

    Required control parameters:
      |NHRU|
      |KE|
      |WfET0|

    Required input sequence:
      |PET|

    Calculated flux sequence:
      |ET0|

    Updated log sequence:
      |WET0|

    Basic equations:
      :math:`ET0_{new} = WfET0 \\cdot KE \\cdot PET +
      (1-WfET0) \\cdot ET0_{alt}`

    Example:

        Prepare four hydrological response units with different value
        combinations of parameters |KE| and |WfET0|:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(4)
        >>> ke(0.8, 1.2, 0.8, 1.2)
        >>> wfet0(2.0, 2.0, 0.2, 0.2)

        Note that the actual value of time dependend parameter |WfET0|
        is reduced due the difference between the given parameter and
        simulation time steps:

        >>> from hydpy import round_
        >>> round_(wfet0.values)
        1.0, 1.0, 0.1, 0.1

        For the first two hydrological response units, the given |PET|
        value is modified by -0.4 mm and +0.4 mm, respectively.  For the
        other two response units, which weight the "new" evaporation
        value with 10 %, |ET0| does deviate from the old value of |WET0|
        by -0.04 mm and +0.04 mm only:

        >>> inputs.pet = 2.0
        >>> logs.wet0 = 2.0
        >>> model.calc_et0_wet0_v1()
        >>> fluxes.et0
        et0(1.6, 2.4, 1.96, 2.04)
        >>> logs.wet0
        wet0([[1.6, 2.4, 1.96, 2.04]])
    """
    con = self.parameters.control.fastaccess
    inp = self.sequences.inputs.fastaccess
    flu = self.sequences.fluxes.fastaccess
    log = self.sequences.logs.fastaccess
    for k in range(con.nhru):
        flu.et0[k] = (con.wfet0[k]*con.ke[k]*inp.pet +
                      (1.-con.wfet0[k])*log.wet0[0, k])
        log.wet0[0, k] = flu.et0[k]


def calc_evpo_v1(self):
    """Calculate land use and month specific values of potential
    evapotranspiration.

    Required control parameters:
      |NHRU|
      |Lnk|
      |FLn|

    Required derived parameter:
      |MOY|

    Required flux sequence:
      |ET0|

    Calculated flux sequence:
      |EvPo|

    Additional requirements:
      |Model.idx_sim|

    Basic equation:
      :math:`EvPo = FLn \\cdot ET0`

    Example:

        For clarity, this is more of a kind of an integration example.
        Parameter |FLn| both depends on time (the actual month) and space
        (the actual land use).  Firstly, let us define a initialization
        time period spanning the transition from June to July:

        >>> from hydpy import pub, Timegrid, Timegrids
        >>> pub.timegrids = Timegrids(Timegrid('30.06.2000',
        ...                                    '02.07.2000',
        ...                                    '1d'))

        Secondly, assume that the considered subbasin is differenciated in
        two HRUs, one of primarily consisting of arable land and the other
        one of deciduous forests:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(2)
        >>> lnk(ACKER, LAUBW)

        Thirdly, set the |FLn|
        values, one for the relevant months and land use classes:

        >>> fln.acker_jun = 1.299
        >>> fln.acker_jul = 1.304
        >>> fln.laubw_jun = 1.350
        >>> fln.laubw_jul = 1.365

        Fourthly, the index array connecting the simulation time steps
        defined above and the month indexes (0...11) can be retrieved
        from the |pub| module.  This can be done manually more
        conveniently via its update method:

        >>> derived.moy.update()
        >>> derived.moy
        moy(5, 6)

        Finally, the actual method (with its simple equation) is applied
        as usual:

        >>> fluxes.et0 = 2.0
        >>> model.idx_sim = 0
        >>> model.calc_evpo_v1()
        >>> fluxes.evpo
        evpo(2.598, 2.7)
        >>> model.idx_sim = 1
        >>> model.calc_evpo_v1()
        >>> fluxes.evpo
        evpo(2.608, 2.73)

        Reset module |pub| to not interfere the following examples:

        >>> pub.timegrids = None
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nhru):
        flu.evpo[k] = con.fln[con.lnk[k]-1, der.moy[self.idx_sim]] * flu.et0[k]


def calc_nbes_inzp_v1(self):
    """Calculate stand precipitation and update the interception storage
    accordingly.

    Required control parameters:
      |NHRU|
      |Lnk|

    Required derived parameter:
      |KInz|

    Required flux sequence:
      |NKor|

    Calculated flux sequence:
      |NBes|

    Updated state sequence:
      |Inzp|

    Additional requirements:
      |Model.idx_sim|

    Basic equation:
      :math:`NBes = \\Bigl \\lbrace
      {
      {PKor \\ | \\ Inzp = KInz}
      \\atop
      {0 \\ | \\ Inzp < KInz}
      }`

    Examples:

        Initialize five HRUs with different land usages:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(5)
        >>> lnk(SIED_D, FEUCHT, GLETS, FLUSS, SEE)

        Define |KInz| values for July the selected land usages directly:

        >>> derived.kinz.sied_d_jul = 2.0
        >>> derived.kinz.feucht_jul = 1.0
        >>> derived.kinz.glets_jul = 0.0
        >>> derived.kinz.fluss_jul = 1.0
        >>> derived.kinz.see_jul = 1.0

        Now we prepare a |MOY| object, that assumes that the first, second,
        and third simulation time steps are in June, July, and August
        respectively (we make use of the value defined above for July, but
        setting the values of parameter |MOY| this way allows for a more
        rigorous testing of proper indexing):

        >>> derived.moy.shape = 3
        >>> derived.moy = 5, 6, 7
        >>> model.idx_sim = 1

        The dense settlement (|SIED_D|), the wetland area (|FEUCHT|), and
        both water areas (|FLUSS| and |SEE|) start with a initial interception
        storage of 1/2 mm, the glacier (|GLETS|) and water areas (|FLUSS| and
        |SEE|) start with 0 mm.  In the first example, actual precipition
        is 1 mm:

        >>> states.inzp = 0.5, 0.5, 0.0, 1.0, 1.0
        >>> fluxes.nkor = 1.0
        >>> model.calc_nbes_inzp_v1()
        >>> states.inzp
        inzp(1.5, 1.0, 0.0, 0.0, 0.0)
        >>> fluxes.nbes
        nbes(0.0, 0.5, 1.0, 0.0, 0.0)

        Only for the settled area, interception capacity is not exceeded,
        meaning no stand precipitation occurs.  Note that it is common in
        define zero interception capacities for glacier areas, but not
        mandatory.  Also note that the |KInz|, |Inzp| and |NKor| values
        given for both water areas are ignored completely, and |Inzp|
        and |NBes| are simply set to zero.

        If there is no precipitation, there is of course also no stand
        precipitation and interception storage remains unchanged:

        >>> states.inzp = 0.5, 0.5, 0.0, 0.0, 0.0
        >>> fluxes.nkor = 0.
        >>> model.calc_nbes_inzp_v1()
        >>> states.inzp
        inzp(0.5, 0.5, 0.0, 0.0, 0.0)
        >>> fluxes.nbes
        nbes(0.0, 0.0, 0.0, 0.0, 0.0)

        Interception capacities change discontinuously between consecutive
        months.  This can result in little stand precipitation events in
        periods without precipitation:

        >>> states.inzp = 1.0, 0.0, 0.0, 0.0, 0.0
        >>> derived.kinz.sied_d_jul = 0.6
        >>> fluxes.nkor = 0.0
        >>> model.calc_nbes_inzp_v1()
        >>> states.inzp
        inzp(0.6, 0.0, 0.0, 0.0, 0.0)
        >>> fluxes.nbes
        nbes(0.4, 0.0, 0.0, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] in (WASSER, FLUSS, SEE):
            flu.nbes[k] = 0.
            sta.inzp[k] = 0.
        else:
            flu.nbes[k] = \
                max(flu.nkor[k]+sta.inzp[k] -
                    der.kinz[con.lnk[k]-1, der.moy[self.idx_sim]], 0.)
            sta.inzp[k] += flu.nkor[k]-flu.nbes[k]


def calc_evi_inzp_v1(self):
    """Calculate interception evaporation and update the interception
    storage accordingly.

    Required control parameters:
      |NHRU|
      |Lnk|
      |TRefT|
      |TRefN|

    Required flux sequence:
      |EvPo|

    Calculated flux sequence:
      |EvI|

    Updated state sequence:
      |Inzp|

    Basic equation:
      :math:`EvI = \\Bigl \\lbrace
      {
      {EvPo \\ | \\ Inzp > 0}
      \\atop
      {0 \\ | \\ Inzp = 0}
      }`

    Examples:

        Initialize five HRUs with different combinations of land usage
        and initial interception storage and apply a value of potential
        evaporation of 3 mm on each one:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(5)
        >>> lnk(FLUSS, SEE, ACKER, ACKER, ACKER)
        >>> states.inzp = 2.0, 2.0, 0.0, 2.0, 4.0
        >>> fluxes.evpo = 3.0
        >>> model.calc_evi_inzp_v1()
        >>> states.inzp
        inzp(0.0, 0.0, 0.0, 0.0, 1.0)
        >>> fluxes.evi
        evi(3.0, 3.0, 0.0, 2.0, 3.0)

        For arable land (|ACKER|) and most other land types, interception
        evaporation (|EvI|) is identical with potential evapotranspiration
        (|EvPo|), as long as it is met by available intercepted water
        ([Inzp|).  Only water areas (|FLUSS| and |SEE|),  |EvI| is
        generally equal to |EvPo| (but this might be corrected by a method
        called after |calc_evi_inzp_v1| has been applied) and [Inzp| is
        set to zero.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] in (WASSER, FLUSS, SEE):
            flu.evi[k] = flu.evpo[k]
            sta.inzp[k] = 0.
        else:
            flu.evi[k] = min(flu.evpo[k], sta.inzp[k])
            sta.inzp[k] -= flu.evi[k]


def calc_sbes_v1(self):
    """Calculate the frozen part of stand precipitation.

    Required control parameters:
      |NHRU|
      |TGr|
      |TSp|

    Required flux sequences:
      |TKor|
      |NBes|

    Calculated flux sequence:
      |SBes|

    Examples:

        In the first example, the threshold temperature of seven hydrological
        response units is 0 °C and the corresponding temperature interval of
        mixed precipitation 2 °C:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(7)
        >>> tgr(0.0)
        >>> tsp(2.0)

        The value of |NBes| is zero above 1 °C and equal to the value of
        |NBes| below -1 °C.  Between these temperature values, |NBes|
        decreases linearly:

        >>> fluxes.nbes = 4.0
        >>> fluxes.tkor = -10.0, -1.0, -0.5, 0.0, 0.5, 1.0, 10.0
        >>> model.calc_sbes_v1()
        >>> fluxes.sbes
        sbes(4.0, 4.0, 3.0, 2.0, 1.0, 0.0, 0.0)

        Note the special case of a zero temperature interval.  With the
        actual temperature being equal to the threshold temperature, the
        the value of `sbes` is zero:

        >>> tsp(0.)
        >>> model.calc_sbes_v1()
        >>> fluxes.sbes
        sbes(4.0, 4.0, 4.0, 0.0, 0.0, 0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nhru):
        if flu.nbes[k] <= 0.:
            flu.sbes[k] = 0.
        elif flu.tkor[k] >= (con.tgr[k]+con.tsp[k]/2.):
            flu.sbes[k] = 0.
        elif flu.tkor[k] <= (con.tgr[k]-con.tsp[k]/2.):
            flu.sbes[k] = flu.nbes[k]
        else:
            flu.sbes[k] = ((((con.tgr[k]+con.tsp[k]/2.)-flu.tkor[k]) /
                            con.tsp[k])*flu.nbes[k])


def calc_wgtf_v1(self):
    """Calculate the potential snowmelt.

    Required control parameters:
      |NHRU|
      |Lnk|
      |GTF|
      |TRefT|
      |TRefN|
      |RSchmelz|
      |CPWasser|

    Required flux sequence:
      |TKor|

    Calculated fluxes sequence:
      |WGTF|

    Basic equation:
      :math:`WGTF = max(GTF \\cdot (TKor - TRefT), 0) +
      max(\\frac{CPWasser}{RSchmelz} \\cdot (TKor - TRefN), 0)`

    Examples:

        Initialize seven HRUs with identical degree-day factors and
        temperature thresholds, but different combinations of land use
        and air temperature:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(7)
        >>> lnk(ACKER, LAUBW, FLUSS, SEE, ACKER, ACKER, ACKER)
        >>> gtf(5.0)
        >>> treft(0.0)
        >>> trefn(1.0)
        >>> fluxes.tkor = 2.0, 2.0, 2.0, 2.0, -1.0, 0.0, 1.0

        Compared to most other LARSIM parameters, the specific heat capacity
        and melt heat capacity of water can be seen as fixed properties:

        >>> cpwasser(4.1868)
        >>> rschmelz(334.0)

        Note that the values of the degree-day factor are only half
        as much as the given value, due to the simulation step size
        being only half as long as the parameter step size:

        >>> gtf
        gtf(5.0)
        >>> gtf.values
        array([ 2.5,  2.5,  2.5,  2.5,  2.5,  2.5,  2.5])

        After performing the calculation, one can see that the potential
        melting rate is identical for the first two HRUs (|ACKER| and
        |LAUBW|).  The land use class results in no difference, except for
        water areas (third and forth HRU, |FLUSS| and |SEE|), where no
        potential melt needs to be calculated.  The last three HRUs (again
        |ACKER|) show the usual behaviour of the degree day method, when the
        actual temperature is below (fourth HRU), equal to (fifth HRU) or
        above (sixths zone) the threshold temperature.  Additionally, the
        first two zones show the influence of the additional energy intake
        due to "warm" precipitation.  Obviously, this additional term is
        quite negligible for common parameterizations, even if lower
        values for the separate threshold temperature |TRefT| would be
        taken into account:

        >>> model.calc_wgtf_v1()
        >>> fluxes.wgtf
        wgtf(5.012535, 5.012535, 0.0, 0.0, 0.0, 0.0, 2.5)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] in (WASSER, FLUSS, SEE):
            flu.wgtf[k] = 0.
        else:
            flu.wgtf[k] = (
              max(con.gtf[k]*(flu.tkor[k]-con.treft[k]), 0) +
              max(con.cpwasser/con.rschmelz*(flu.tkor[k]-con.trefn[k]), 0.))


def calc_schm_wats_v1(self):
    """Calculate the actual amount of water melting within the snow cover.

    Required control parameters:
      |NHRU|
      |Lnk|

    Required flux sequences:
      |SBes|
      |WGTF|

    Calculated flux sequence:
      |Schm|

    Updated state sequence:
      |WATS|

    Basic equations:
      :math:`\\frac{dWATS}{dt}  = SBes - Schm`
      :math:`Schm = \\Bigl \\lbrace
      {
      {WGTF \\ | \\ WATS > 0}
      \\atop
      {0 \\ | \\ WATS = 0}
      }`

    Examples:

        Initialize two water (|FLUSS| and |SEE|) and four arable land
        (|ACKER|) HRUs.  Assume the same values for the initial amount
        of frozen water (|WATS|) and the frozen part of stand precipitation
        (|SBes|), but different values for potential snowmelt (|WGTF|):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(6)
        >>> lnk(FLUSS, SEE, ACKER, ACKER, ACKER, ACKER)
        >>> states.wats = 2.0
        >>> fluxes.sbes = 1.0
        >>> fluxes.wgtf = 1.0, 1.0, 0.0, 1.0, 3.0, 5.0
        >>> model.calc_schm_wats_v1()
        >>> states.wats
        wats(0.0, 0.0, 3.0, 2.0, 0.0, 0.0)
        >>> fluxes.schm
        schm(0.0, 0.0, 0.0, 1.0, 3.0, 3.0)

        For the water areas, both the frozen amount of water and actual melt
        are set to zero.  For all other land use classes, actual melt
        is either limited by potential melt or the available frozen water,
        which is the sum of initial frozen water and the frozen part
        of stand precipitation.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] in (WASSER, FLUSS, SEE):
            sta.wats[k] = 0.
            flu.schm[k] = 0.
        else:
            sta.wats[k] += flu.sbes[k]
            flu.schm[k] = min(flu.wgtf[k], sta.wats[k])
            sta.wats[k] -= flu.schm[k]


def calc_wada_waes_v1(self):
    """Calculate the actual water release from the snow cover.

    Required control parameters:
      |NHRU|
      |Lnk|
      |PWMax|

    Required flux sequences:
      |NBes|

    Calculated flux sequence:
      |WaDa|

    Updated state sequence:
      |WAeS|

    Basic equations:
      :math:`\\frac{dWAeS}{dt} = NBes - WaDa`
      :math:`WAeS \\leq PWMax \\cdot WATS`

    Examples:

        For simplicity, the threshold parameter |PWMax| is set to a value
        of two for each of the six initialized HRUs.  Thus, snow cover can
        hold as much liquid water as it contains frozen water.  Stand
        precipitation is also always set to the same value, but the initial
        conditions of the snow cover are varied:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(6)
        >>> lnk(FLUSS, SEE, ACKER, ACKER, ACKER, ACKER)
        >>> pwmax(2.0)
        >>> fluxes.nbes = 1.0
        >>> states.wats = 0.0, 0.0, 0.0, 1.0, 1.0, 1.0
        >>> states.waes = 1.0, 1.0, 0.0, 1.0, 1.5, 2.0
        >>> model.calc_wada_waes_v1()
        >>> states.waes
        waes(0.0, 0.0, 0.0, 2.0, 2.0, 2.0)
        >>> fluxes.wada
        wada(1.0, 1.0, 1.0, 0.0, 0.5, 1.0)

        Note the special cases of the first two HRUs of type |FLUSS| and
        |SEE|.  For water areas, stand precipitaton |NBes| is generally
        passed to |WaDa| and |WAeS| is set to zero.  For all other land
        use classes (of which only |ACKER| is selected), only the amount
        of |NBes| exceeding the actual snow holding capacity is passed
        to |WaDa|.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] in (WASSER, FLUSS, SEE):
            sta.waes[k] = 0.
            flu.wada[k] = flu.nbes[k]
        else:
            sta.waes[k] += flu.nbes[k]
            flu.wada[k] = max(sta.waes[k]-con.pwmax[k]*sta.wats[k], 0.)
            sta.waes[k] -= flu.wada[k]


def calc_evb_v1(self):
    """Calculate the actual water release from the snow cover.

    Required control parameters:
      |NHRU|
      |Lnk|
      |NFk|
      |GrasRef_R|

    Required state sequence:
      |BoWa|

    Required flux sequences:
      |EvPo|
      |EvI|

    Calculated flux sequence:
      |EvB|

    Basic equations:
      :math:`temp = exp(-GrasRef_R \\cdot \\frac{BoWa}{NFk})`
      :math:`EvB = (EvPo - EvI) \\cdot
      \\frac{1 - temp}{1 + temp -2 \\cdot exp(-GrasRef_R)}`

    Examples:

        Soil evaporation is calculated neither for water nor for sealed
        areas (see the first three HRUs of type |FLUSS|, |SEE|, and |VERS|).
        All other land use classes are handled in accordance with a
        recommendation of the set of codes described in ATV-DVWK-M 504
        (arable land |ACKER| has been selected for the last four HRUs
        arbitrarily):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(7)
        >>> lnk(FLUSS, SEE, VERS, ACKER, ACKER, ACKER, ACKER)
        >>> grasref_r(5.0)
        >>> nfk(100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0)
        >>> fluxes.evpo = 5.0
        >>> fluxes.evi = 3.0
        >>> states.bowa = 50.0, 50.0, 50.0, 0.0, 0.0, 50.0, 100.0
        >>> model.calc_evb_v1()
        >>> fluxes.evb
        evb(0.0, 0.0, 0.0, 0.0, 0.0, 1.717962, 2.0)

        In case usable field capacity (|NFk|) is zero, soil evaporation
        (|EvB|) is generally set to zero (see the forth HRU).  The last
        three HRUs demonstrate the rise in soil evaporation with increasing
        soil moisture, which is lessening in the high soil moisture range.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if (con.lnk[k] in (VERS, WASSER, FLUSS, SEE)) or (con.nfk[k] <= 0.):
            flu.evb[k] = 0.
        else:
            d_temp = modelutils.exp(-con.grasref_r *
                                    sta.bowa[k]/con.nfk[k])
            flu.evb[k] = ((flu.evpo[k]-flu.evi[k]) * (1.-d_temp) /
                          (1.+d_temp-2.*modelutils.exp(-con.grasref_r)))


def calc_qbb_v1(self):
    """Calculate the amount of base flow released from the soil.

    Required control parameters:
      |NHRU|
      |Lnk|
      |Beta|
      |FBeta|

    Required derived parameter:
      |WB|
      |WZ|

    Required state sequence:
      |BoWa|

    Calculated flux sequence:
      |QBB|

    Basic equations:
      :math:`Beta_{eff} = \\Bigl \\lbrace
      {
      {Beta \\ | \\ BoWa \\leq WZ}
      \\atop
      {Beta \\cdot (1+(FBeta-1)\\cdot\\frac{BoWa-WZ}{NFk-WZ}) \\|\\ BoWa > WZ}
      }`

      :math:`QBB = \\Bigl \\lbrace
      {
      {0 \\ | \\ BoWa \\leq WB}
      \\atop
      {Beta_{eff}  \\cdot (BoWa - WB) \\|\\ BoWa > WB}
      }`

    Examples:

        For water and sealed areas, no base flow is calculated (see the
        first three HRUs of type |VERS|, |FLUSS|, and |SEE|).  No principal
        distinction is made between the remaining land use classes (arable
        land |ACKER| has been selected for the last five HRUs arbitrarily):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(8)
        >>> lnk(FLUSS, SEE, VERS, ACKER, ACKER, ACKER, ACKER, ACKER)
        >>> beta(0.04)
        >>> fbeta(2.0)
        >>> nfk(100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 200.0)
        >>> derived.wb(10.0)
        >>> derived.wz(70.0)

        Note the time dependence of parameter |Beta|:

        >>> beta
        beta(0.04)
        >>> beta.values
        array([ 0.02,  0.02,  0.02,  0.02,  0.02,  0.02,  0.02,  0.02])

        In the first example, the actual soil water content |BoWa| is set
        to low values.  For values below the threshold |WB|, not percolation
        occurs.  Above |WB| (but below |WZ|), |QBB| increases linearly by
        an amount defined by parameter |Beta|:

        >>> states.bowa = 20.0, 20.0, 20.0, 0.0, 0.0, 10.0, 20.0, 20.0
        >>> model.calc_qbb_v1()
        >>> fluxes.qbb
        qbb(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.2)

        Note that for the last two HRUs the same amount of
        base flow generation is determined, in spite of the fact
        that both exhibit different relative soil moistures.  It is
        common to modify this "pure absolute dependency" to a "mixed
        absolute/relative dependency" through defining the values of
        parameter |WB| indirectly via parameter |RelWB|.

        In the second example, the actual soil water content |BoWa| is set
        to high values.  For values below threshold |WZ|, the discussion above
        remains valid.  For values above |WZ|, percolation shows a nonlinear
        behaviour when factor |FBeta| is set to values larger than one:

        >>> nfk(0.0, 0.0, 0.0, 100.0, 100.0, 100.0, 100.0, 200.0)
        >>> states.bowa = 0.0, 0.0, 0.0, 60.0, 70.0, 80.0, 100.0, 200.0
        >>> model.calc_qbb_v1()
        >>> fluxes.qbb
        qbb(0.0, 0.0, 0.0, 1.0, 1.2, 1.866667, 3.6, 7.6)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if ((con.lnk[k] in (VERS, WASSER, FLUSS, SEE)) or
                (sta.bowa[k] <= der.wb[k]) or (con.nfk[k] <= 0.)):
            flu.qbb[k] = 0.
        elif sta.bowa[k] <= der.wz[k]:
            flu.qbb[k] = con.beta[k]*(sta.bowa[k]-der.wb[k])
        else:
            flu.qbb[k] = (con.beta[k]*(sta.bowa[k]-der.wb[k]) *
                          (1.+(con.fbeta[k]-1.)*((sta.bowa[k]-der.wz[k]) /
                                                 (con.nfk[k]-der.wz[k]))))


def calc_qib1_v1(self):
    """Calculate the first inflow component released from the soil.

    Required control parameters:
      |NHRU|
      |Lnk|
      |NFk|
      |DMin|

    Required derived parameter:
      |WB|

    Required state sequence:
      |BoWa|

    Calculated flux sequence:
      |QIB1|

    Basic equation:
      :math:`QIB1 = DMin \\cdot \\frac{BoWa}{NFk}`

    Examples:

        For water and sealed areas, no interflow is calculated (the first
        three HRUs are of type |FLUSS|, |SEE|, and |VERS|, respectively).
        No principal distinction is made between the remaining land use
        classes (arable land |ACKER| has been selected for the last five
        HRUs arbitrarily):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(8)
        >>> lnk(FLUSS, SEE, VERS, ACKER, ACKER, ACKER, ACKER, ACKER)
        >>> dmax(10.0)
        >>> dmin(4.0)
        >>> nfk(101.0, 101.0, 101.0, 0.0, 101.0, 101.0, 101.0, 202.0)
        >>> derived.wb(10.0)
        >>> states.bowa = 10.1, 10.1, 10.1, 0.0, 0.0, 10.0, 10.1, 10.1

        Note the time dependence of parameter |DMin|:

        >>> dmin
        dmin(4.0)
        >>> dmin.values
        array([ 2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.])

        Compared to the calculation of |QBB|, the following results show
        some relevant differences:

        >>> model.calc_qib1_v1()
        >>> fluxes.qib1
        qib1(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.1)

        Firstly, as demonstrated with the help of the seventh and the
        eight HRU, the generation of the first interflow component |QIB1|
        depends on relative soil moisture.  Secondly, as demonstrated with
        the help the sixth and seventh HRU, it starts abruptly whenever
        the slightest exceedance of the threshold  parameter |WB| occurs.
        Such sharp discontinuouties are a potential source of trouble.
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if ((con.lnk[k] in (VERS, WASSER, FLUSS, SEE)) or
                (sta.bowa[k] <= der.wb[k])):
            flu.qib1[k] = 0.
        else:
            flu.qib1[k] = con.dmin[k]*(sta.bowa[k]/con.nfk[k])


def calc_qib2_v1(self):
    """Calculate the first inflow component released from the soil.

    Required control parameters:
      |NHRU|
      |Lnk|
      |NFk|
      |DMin|
      |DMax|

    Required derived parameter:
      |WZ|

    Required state sequence:
      |BoWa|

    Calculated flux sequence:
      |QIB2|

    Basic equation:
      :math:`QIB2 = (DMax-DMin) \\cdot
      (\\frac{BoWa-WZ}{NFk-WZ})^\\frac{3}{2}`

    Examples:

        For water and sealed areas, no interflow is calculated (the first
        three HRUs are of type |FLUSS|, |SEE|, and |VERS|, respectively).
        No principal distinction is made between the remaining land use
        classes (arable land |ACKER| has been selected for the last
        five HRUs arbitrarily):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(8)
        >>> lnk(FLUSS, SEE, VERS, ACKER, ACKER, ACKER, ACKER, ACKER)
        >>> dmax(10.0)
        >>> dmin(4.0)
        >>> nfk(100.0, 100.0, 100.0, 50.0, 100.0, 100.0, 100.0, 200.0)
        >>> derived.wz(50.0)
        >>> states.bowa = 100.0, 100.0, 100.0, 50.1, 50.0, 75.0, 100.0, 100.0

        Note the time dependence of parameters |DMin| (see the example above)
        and |DMax|:

        >>> dmax
        dmax(10.0)
        >>> dmax.values
        array([ 5.,  5.,  5.,  5.,  5.,  5.,  5.,  5.])

        The following results show that he calculation of |QIB2| both
        resembles those of |QBB| and |QIB1| in some regards:

        >>> model.calc_qib2_v1()
        >>> fluxes.qib2
        qib2(0.0, 0.0, 0.0, 0.0, 0.0, 1.06066, 3.0, 0.57735)

        In the given example, the maximum rate of total interflow
        generation is 5 mm/12h (parameter |DMax|).  For the seventh zone,
        which contains a saturated soil, the value calculated for the
        second interflow component (|QIB2|) is 3 mm/h.  The "missing"
        value of 2 mm/12h is be calculated by method |calc_qib1_v1|.

        (The fourth zone, which is slightly oversaturated, is only intended
        to demonstrate that zero division due to |NFk| = |WZ| is circumvented.)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    for k in range(con.nhru):
        if ((con.lnk[k] in (VERS, WASSER, FLUSS, SEE)) or
                (sta.bowa[k] <= der.wz[k]) or (con.nfk[k] <= der.wz[k])):
            flu.qib2[k] = 0.
        else:
            flu.qib2[k] = ((con.dmax[k]-con.dmin[k]) *
                           ((sta.bowa[k]-der.wz[k]) /
                            (con.nfk[k]-der.wz[k]))**1.5)


def calc_qdb_v1(self):
    """Calculate direct runoff released from the soil.

    Required control parameters:
      |NHRU|
      |Lnk|
      |NFk|
      |BSf|

    Required state sequence:
      |BoWa|

    Required flux sequence:
      |WaDa|

    Calculated flux sequence:
      |QDB|

    Basic equations:
      :math:`QDB = \\Bigl \\lbrace
      {
      {max(Exz, 0) \\ | \\ SfA \\leq 0}
      \\atop
      {max(Exz + NFk \\cdot SfA^{BSf+1}, 0) \\ | \\ SfA > 0}
      }`
      :math:`SFA = (1 - \\frac{BoWa}{NFk})^\\frac{1}{BSf+1} -
      \\frac{WaDa}{(BSf+1) \\cdot NFk}`
      :math:`Exz = (BoWa + WaDa) - NFk`

    Examples:

        For water areas (|FLUSS| and |SEE|), sealed areas (|VERS|), and
        areas without any soil storage capacity, all water is completely
        routed as direct runoff |QDB| (see the first four HRUs).  No
        principal distinction is made between the remaining land use
        classes (arable land |ACKER| has been selected for the last five
        HRUs arbitrarily):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> nhru(9)
        >>> lnk(FLUSS, SEE, VERS, ACKER, ACKER, ACKER, ACKER, ACKER, ACKER)
        >>> bsf(0.4)
        >>> nfk(100.0, 100.0, 100.0, 0.0, 100.0, 100.0, 100.0, 100.0, 100.0)
        >>> fluxes.wada = 10.0
        >>> states.bowa = (
        ...     100.0, 100.0, 100.0, 0.0, -0.1, 0.0, 50.0, 100.0, 100.1)
        >>> model.calc_qdb_v1()
        >>> fluxes.qdb
        qdb(10.0, 10.0, 10.0, 10.0, 0.142039, 0.144959, 1.993649, 10.0, 10.1)

        With the common |BSf| value of 0.4, the discharge coefficient
        increases more or less exponentially with soil moisture.
        For soil moisture values slightly below zero or above usable
        field capacity, plausible amounts of generated direct runoff
        are ensured.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    aid = self.sequences.aides.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] == WASSER:
            flu.qdb[k] = 0.
        elif ((con.lnk[k] in (VERS, FLUSS, SEE)) or
                (con.nfk[k] <= 0.)):
            flu.qdb[k] = flu.wada[k]
        else:
            if sta.bowa[k] < con.nfk[k]:
                aid.sfa[k] = (
                    (1.-sta.bowa[k]/con.nfk[k])**(1./(con.bsf[k]+1.)) -
                    (flu.wada[k]/((con.bsf[k]+1.)*con.nfk[k])))
            else:
                aid.sfa[k] = 0.
            aid.exz[k] = sta.bowa[k]+flu.wada[k]-con.nfk[k]
            flu.qdb[k] = aid.exz[k]
            if aid.sfa[k] > 0.:
                flu.qdb[k] += aid.sfa[k]**(con.bsf[k]+1.)*con.nfk[k]
            flu.qdb[k] = max(flu.qdb[k], 0.)


def calc_bowa_v1(self):
    """Update soil moisture and correct fluxes if necessary.

    Required control parameters:
      |NHRU|
      |Lnk|

    Required flux sequence:
      |WaDa|

    Updated state sequence:
      |BoWa|

    Required (and eventually corrected) flux sequences:
      |EvB|
      |QBB|
      |QIB1|
      |QIB2|
      |QDB|

    Basic equations:
       :math:`\\frac{dBoWa}{dt} = WaDa - EvB - QBB - QIB1 - QIB2 - QDB`
       :math:`BoWa \\geq 0`

    Examples:

        For water areas (|FLUSS| and |SEE|) and sealed areas (|VERS|),
        soil moisture |BoWa| is simply set to zero and no flux correction
        are performed (see the first three HRUs).  No principal distinction
        is made between the remaining land use classes (arable land |ACKER|
        has been selected for the last four HRUs arbitrarily):

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(7)
        >>> lnk(FLUSS, SEE, VERS, ACKER, ACKER, ACKER, ACKER)
        >>> states.bowa = 2.0
        >>> fluxes.wada = 1.0
        >>> fluxes.evb = 1.0, 1.0, 1.0, 0.0, 0.1, 0.2, 0.3
        >>> fluxes.qbb = 1.0, 1.0, 1.0, 0.0, 0.2, 0.4, 0.6
        >>> fluxes.qib1 = 1.0, 1.0, 1.0, 0.0, 0.3, 0.6, 0.9
        >>> fluxes.qib2 = 1.0, 1.0, 1.0, 0.0, 0.4, 0.8, 1.2
        >>> fluxes.qdb = 1.0, 1.0, 1.0, 0.0, 0.5, 1.0, 1.5
        >>> model.calc_bowa_v1()
        >>> states.bowa
        bowa(0.0, 0.0, 0.0, 3.0, 1.5, 0.0, 0.0)
        >>> fluxes.evb
        evb(1.0, 1.0, 1.0, 0.0, 0.1, 0.2, 0.2)
        >>> fluxes.qbb
        qbb(1.0, 1.0, 1.0, 0.0, 0.2, 0.4, 0.4)
        >>> fluxes.qib1
        qib1(1.0, 1.0, 1.0, 0.0, 0.3, 0.6, 0.6)
        >>> fluxes.qib2
        qib2(1.0, 1.0, 1.0, 0.0, 0.4, 0.8, 0.8)
        >>> fluxes.qdb
        qdb(1.0, 1.0, 1.0, 0.0, 0.5, 1.0, 1.0)

        For the seventh HRU, the original total loss terms would result in a
        negative soil moisture value.  Hence it is reduced to the total loss
        term of the sixt HRU, which results exactly in a complete emptying
        of the soil storage.
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    aid = self.sequences.aides.fastaccess
    for k in range(con.nhru):
        if con.lnk[k] in (VERS, WASSER, FLUSS, SEE):
            sta.bowa[k] = 0.
        else:
            aid.bvl[k] = (
                flu.evb[k]+flu.qbb[k]+flu.qib1[k]+flu.qib2[k]+flu.qdb[k])
            aid.mvl[k] = sta.bowa[k]+flu.wada[k]
            if aid.bvl[k] > aid.mvl[k]:
                aid.rvl[k] = aid.mvl[k]/aid.bvl[k]
                flu.evb[k] *= aid.rvl[k]
                flu.qbb[k] *= aid.rvl[k]
                flu.qib1[k] *= aid.rvl[k]
                flu.qib2[k] *= aid.rvl[k]
                flu.qdb[k] *= aid.rvl[k]
                sta.bowa[k] = 0.
            else:
                sta.bowa[k] = aid.mvl[k]-aid.bvl[k]


def calc_qbgz_v1(self):
    """Aggregate the amount of base flow released by all "soil type" HRUs
    and the "net precipitation" above water areas of type |SEE|.

    Water areas of type |SEE| are assumed to be directly connected with
    groundwater, but not with the stream network.  This is modelled by
    adding their (positive or negative) "net input" (|NKor|-|EvI|) to the
    "percolation output" of the soil containing HRUs.

    Required control parameters:
      |Lnk|
      |NHRU|
      |FHRU|

    Required flux sequences:
      |QBB|
      |NKor|
      |EvI|

    Calculated state sequence:
      |QBGZ|

    Basic equation:
       :math:`QBGZ = \\Sigma(FHRU \\cdot QBB) +
       \\Sigma(FHRU \\cdot (NKor_{SEE}-EvI_{SEE}))`

    Examples:

        The first example shows that |QBGZ| is the area weighted sum of
        |QBB| from "soil type" HRUs like arable land (|ACKER|) and of
        |NKor|-|EvI| from water areas of type |SEE|.  All other water
        areas (|WASSER| and |FLUSS|) and also sealed surfaces (|VERS|)
        have no impact on |QBGZ|:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> nhru(6)
        >>> lnk(ACKER, ACKER, VERS, WASSER, FLUSS, SEE)
        >>> fhru(0.1, 0.2, 0.1, 0.1, 0.1, 0.4)
        >>> fluxes.qbb = 2., 4.0, 300.0, 300.0, 300.0, 300.0
        >>> fluxes.nkor = 200.0, 200.0, 200.0, 200.0, 200.0, 20.0
        >>> fluxes.evi = 100.0, 100.0, 100.0, 100.0, 100.0, 10.0
        >>> model.calc_qbgz_v1()
        >>> states.qbgz
        qbgz(5.0)

        The second example shows that large evaporation values above a
        HRU of type |SEE| can result in negative values of |QBGZ|:

        >>> fluxes.evi[5] = 30
        >>> model.calc_qbgz_v1()
        >>> states.qbgz
        qbgz(-3.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    sta.qbgz = 0.
    for k in range(con.nhru):
        if con.lnk[k] == SEE:
            sta.qbgz += con.fhru[k]*(flu.nkor[k]-flu.evi[k])
        elif con.lnk[k] not in (WASSER, FLUSS, VERS):
            sta.qbgz += con.fhru[k]*flu.qbb[k]


def calc_qigz1_v1(self):
    """Aggregate the amount of the first interflow component released
    by all HRUs.

    Required control parameters:
      |NHRU|
      |FHRU|

    Required flux sequence:
      |QIB1|

    Calculated state sequence:
      |QIGZ1|

    Basic equation:
       :math:`QIGZ1 = \\Sigma(FHRU \\cdot QIB1)`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> nhru(2)
        >>> fhru(0.75, 0.25)
        >>> fluxes.qib1 = 1.0, 5.0
        >>> model.calc_qigz1_v1()
        >>> states.qigz1
        qigz1(2.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    sta.qigz1 = 0.
    for k in range(con.nhru):
        sta.qigz1 += con.fhru[k]*flu.qib1[k]


def calc_qigz2_v1(self):
    """Aggregate the amount of the second interflow component released
    by all HRUs.

    Required control parameters:
      |NHRU|
      |FHRU|

    Required flux sequence:
      |QIB2|

    Calculated state sequence:
      |QIGZ2|

    Basic equation:
       :math:`QIGZ2 = \\Sigma(FHRU \\cdot QIB2)`

    Example:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> nhru(2)
        >>> fhru(0.75, 0.25)
        >>> fluxes.qib2 = 1.0, 5.0
        >>> model.calc_qigz2_v1()
        >>> states.qigz2
        qigz2(2.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    sta.qigz2 = 0.
    for k in range(con.nhru):
        sta.qigz2 += con.fhru[k]*flu.qib2[k]


def calc_qdgz_v1(self):
    """Aggregate the amount of total direct flow released by all HRUs.

    Required control parameters:
      |Lnk|
      |NHRU|
      |FHRU|

    Required flux sequence:
      |QDB|
      |NKor|
      |EvI|

    Calculated flux sequence:
      |QDGZ|

    Basic equation:
       :math:`QDGZ = \\Sigma(FHRU \\cdot QDB) +
       \\Sigma(FHRU \\cdot (NKor_{FLUSS}-EvI_{FLUSS}))`

    Examples:

        The first example shows that |QDGZ| is the area weighted sum of
        |QDB| from "land type" HRUs like arable land (|ACKER|) and sealed
        surfaces (|VERS|) as well as of |NKor|-|EvI| from water areas of
        type |FLUSS|.  Water areas of type |WASSER| and |SEE| have no
        impact on |QDGZ|:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> nhru(5)
        >>> lnk(ACKER, VERS, WASSER, SEE, FLUSS)
        >>> fhru(0.1, 0.2, 0.1, 0.2, 0.4)
        >>> fluxes.qdb = 2., 4.0, 300.0, 300.0, 300.0
        >>> fluxes.nkor = 200.0, 200.0, 200.0, 200.0, 20.0
        >>> fluxes.evi = 100.0, 100.0, 100.0, 100.0, 10.0
        >>> model.calc_qdgz_v1()
        >>> fluxes.qdgz
        qdgz(5.0)

        The second example shows that large evaporation values above a
        HRU of type |FLUSS| can result in negative values of |QDGZ|:

        >>> fluxes.evi[4] = 30
        >>> model.calc_qdgz_v1()
        >>> fluxes.qdgz
        qdgz(-3.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    flu.qdgz = 0.
    for k in range(con.nhru):
        if con.lnk[k] == FLUSS:
            flu.qdgz += con.fhru[k]*(flu.nkor[k]-flu.evi[k])
        elif con.lnk[k] not in (WASSER, SEE):
            flu.qdgz += con.fhru[k]*flu.qdb[k]


def calc_qdgz1_qdgz2_v1(self):
    """Seperate total direct flow into a small and a fast component.

    Required control parameters:
      |A1|
      |A2|

    Required flux sequence:
      |QDGZ|

    Calculated state sequences:
      |QDGZ1|
      |QDGZ2|

    Basic equation:
       :math:`QDGZ2 = \\frac{(QDGZ-A2)^2}{QDGZ+A1-A2}`
       :math:`QDGZ1 = QDGZ - QDGZ1`

    Examples:

        The formula for calculating the amount of the fast component of
        direct flow is borrowed from the famous curve number approach.
        Parameter |A2| would be the initial loss and parameter |A1| the
        maximum storage, but one should not take this analogy too serious.
        Instead, with the value of parameter |A1| set to zero, parameter
        |A2| just defines the maximum amount of "slow" direct runoff per
        time step:

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> simulationstep('12h')
        >>> a1(0.0)

        Let us set the value of |A2| to 4 mm/d, which is 2 mm/12h with
        respect to the selected simulation step size:

        >>> a2(4.0)
        >>> a2
        a2(4.0)
        >>> a2.value
        2.0

        Define a test function and let it calculate |QDGZ1| and |QDGZ1| for
        values of |QDGZ| ranging from -10 to 100 mm/12h:

        >>> from hydpy import UnitTest
        >>> test = UnitTest(model,
        ...                 model.calc_qdgz1_qdgz2_v1,
        ...                 last_example=6,
        ...                 parseqs=(fluxes.qdgz,
        ...                          states.qdgz1,
        ...                          states.qdgz2))
        >>> test.nexts.qdgz = -10.0, 0.0, 1.0, 2.0, 3.0, 100.0
        >>> test()
        | ex. |  qdgz | qdgz1 | qdgz2 |
        -------------------------------
        |   1 | -10.0 | -10.0 |   0.0 |
        |   2 |   0.0 |   0.0 |   0.0 |
        |   3 |   1.0 |   1.0 |   0.0 |
        |   4 |   2.0 |   2.0 |   0.0 |
        |   5 |   3.0 |   2.0 |   1.0 |
        |   6 | 100.0 |   2.0 |  98.0 |

        Setting |A2| to zero and |A1| to 4 mm/d (or 2 mm/12h) results in
        a smoother transition:

        >>> a2(0.0)
        >>> a1(4.0)
        >>> test()
        | ex. |  qdgz |    qdgz1 |     qdgz2 |
        --------------------------------------
        |   1 | -10.0 |    -10.0 |       0.0 |
        |   2 |   0.0 |      0.0 |       0.0 |
        |   3 |   1.0 | 0.666667 |  0.333333 |
        |   4 |   2.0 |      1.0 |       1.0 |
        |   5 |   3.0 |      1.2 |       1.8 |
        |   6 | 100.0 | 1.960784 | 98.039216 |

        Alternatively, one can mix these two configurations by setting
        the values of both parameters to 2 mm/h:

        >>> a2(2.0)
        >>> a1(2.0)
        >>> test()
        | ex. |  qdgz |    qdgz1 |    qdgz2 |
        -------------------------------------
        |   1 | -10.0 |    -10.0 |      0.0 |
        |   2 |   0.0 |      0.0 |      0.0 |
        |   3 |   1.0 |      1.0 |      0.0 |
        |   4 |   2.0 |      1.5 |      0.5 |
        |   5 |   3.0 | 1.666667 | 1.333333 |
        |   6 | 100.0 |     1.99 |    98.01 |

        Note the similarity of the results for very high values of total
        direct flow |QDGZ| in all three examples, which converge to the sum
        of the values of parameter |A1| and |A2|, representing the maximum
        value of `slow` direct flow generation per simulation step
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    if flu.qdgz > con.a2:
        sta.qdgz2 = (flu.qdgz-con.a2)**2/(flu.qdgz+con.a1-con.a2)
        sta.qdgz1 = flu.qdgz-sta.qdgz2
    else:
        sta.qdgz2 = 0.
        sta.qdgz1 = flu.qdgz


def calc_qbga_v1(self):
    """Perform the runoff concentration calculation for base flow.

    The working equation is the analytical solution of the linear storage
    equation under the assumption of constant change in inflow during
    the simulation time step.

    Required derived parameter:
      |KB|

    Required flux sequence:
      |QBGZ|

    Calculated state sequence:
      |QBGA|

    Basic equation:
       :math:`QBGA_{neu} = QBGA_{alt} +
       (QBGZ_{alt}-QBGA_{alt}) \\cdot (1-exp(-KB^{-1})) +
       (QBGZ_{neu}-QBGZ_{alt}) \\cdot (1-KB\\cdot(1-exp(-KB^{-1})))`

    Examples:

        A normal test case:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> derived.kb(0.1)
        >>> states.qbgz.old = 2.0
        >>> states.qbgz.new = 4.0
        >>> states.qbga.old = 3.0
        >>> model.calc_qbga_v1()
        >>> states.qbga
        qbga(3.800054)

        First extreme test case (zero division is circumvented):

        >>> derived.kb(0.0)
        >>> model.calc_qbga_v1()
        >>> states.qbga
        qbga(4.0)

        Second extreme test case (numerical overflow is circumvented):

        >>> derived.kb(1e500)
        >>> model.calc_qbga_v1()
        >>> states.qbga
        qbga(5.0)
    """
    der = self.parameters.derived.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    if der.kb <= 0.:
        new.qbga = new.qbgz
    elif der.kb > 1e200:
        new.qbga = old.qbga+new.qbgz-old.qbgz
    else:
        d_temp = (1.-modelutils.exp(-1./der.kb))
        new.qbga = (old.qbga +
                    (old.qbgz-old.qbga)*d_temp +
                    (new.qbgz-old.qbgz)*(1.-der.kb*d_temp))


def calc_qiga1_v1(self):
    """Perform the runoff concentration calculation for the first
    interflow component.

    The working equation is the analytical solution of the linear storage
    equation under the assumption of constant change in inflow during
    the simulation time step.

    Required derived parameter:
      |KI1|

    Required state sequence:
      |QIGZ1|

    Calculated state sequence:
      |QIGA1|

    Basic equation:
       :math:`QIGA1_{neu} = QIGA1_{alt} +
       (QIGZ1_{alt}-QIGA1_{alt}) \\cdot (1-exp(-KI1^{-1})) +
       (QIGZ1_{neu}-QIGZ1_{alt}) \\cdot (1-KI1\\cdot(1-exp(-KI1^{-1})))`

    Examples:

        A normal test case:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> derived.ki1(0.1)
        >>> states.qigz1.old = 2.0
        >>> states.qigz1.new = 4.0
        >>> states.qiga1.old = 3.0
        >>> model.calc_qiga1_v1()
        >>> states.qiga1
        qiga1(3.800054)

        First extreme test case (zero division is circumvented):

        >>> derived.ki1(0.0)
        >>> model.calc_qiga1_v1()
        >>> states.qiga1
        qiga1(4.0)

        Second extreme test case (numerical overflow is circumvented):

        >>> derived.ki1(1e500)
        >>> model.calc_qiga1_v1()
        >>> states.qiga1
        qiga1(5.0)
    """
    der = self.parameters.derived.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    if der.ki1 <= 0.:
        new.qiga1 = new.qigz1
    elif der.ki1 > 1e200:
        new.qiga1 = old.qiga1+new.qigz1-old.qigz1
    else:
        d_temp = (1.-modelutils.exp(-1./der.ki1))
        new.qiga1 = (old.qiga1 +
                     (old.qigz1-old.qiga1)*d_temp +
                     (new.qigz1-old.qigz1)*(1.-der.ki1*d_temp))


def calc_qiga2_v1(self):
    """Perform the runoff concentration calculation for the second
    interflow component.

    The working equation is the analytical solution of the linear storage
    equation under the assumption of constant change in inflow during
    the simulation time step.

    Required derived parameter:
      |KI2|

    Required state sequence:
      |QIGZ2|

    Calculated state sequence:
      |QIGA2|

    Basic equation:
       :math:`QIGA2_{neu} = QIGA2_{alt} +
       (QIGZ2_{alt}-QIGA2_{alt}) \\cdot (1-exp(-KI2^{-1})) +
       (QIGZ2_{neu}-QIGZ2_{alt}) \\cdot (1-KI2\\cdot(1-exp(-KI2^{-1})))`

    Examples:

        A normal test case:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> derived.ki2(0.1)
        >>> states.qigz2.old = 2.0
        >>> states.qigz2.new = 4.0
        >>> states.qiga2.old = 3.0
        >>> model.calc_qiga2_v1()
        >>> states.qiga2
        qiga2(3.800054)

        First extreme test case (zero division is circumvented):

        >>> derived.ki2(0.0)
        >>> model.calc_qiga2_v1()
        >>> states.qiga2
        qiga2(4.0)

        Second extreme test case (numerical overflow is circumvented):

        >>> derived.ki2(1e500)
        >>> model.calc_qiga2_v1()
        >>> states.qiga2
        qiga2(5.0)
    """
    der = self.parameters.derived.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    if der.ki2 <= 0.:
        new.qiga2 = new.qigz2
    elif der.ki2 > 1e200:
        new.qiga2 = old.qiga2+new.qigz2-old.qigz2
    else:
        d_temp = (1.-modelutils.exp(-1./der.ki2))
        new.qiga2 = (old.qiga2 +
                     (old.qigz2-old.qiga2)*d_temp +
                     (new.qigz2-old.qigz2)*(1.-der.ki2*d_temp))


def calc_qdga1_v1(self):
    """Perform the runoff concentration calculation for "slow" direct runoff.

    The working equation is the analytical solution of the linear storage
    equation under the assumption of constant change in inflow during
    the simulation time step.

    Required derived parameter:
      |KD1|

    Required state sequence:
      |QDGZ1|

    Calculated state sequence:
      |QDGA1|

    Basic equation:
       :math:`QDGA1_{neu} = QDGA1_{alt} +
       (QDGZ1_{alt}-QDGA1_{alt}) \\cdot (1-exp(-KD1^{-1})) +
       (QDGZ1_{neu}-QDGZ1_{alt}) \\cdot (1-KD1\\cdot(1-exp(-KD1^{-1})))`

    Examples:

        A normal test case:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> derived.kd1(0.1)
        >>> states.qdgz1.old = 2.0
        >>> states.qdgz1.new = 4.0
        >>> states.qdga1.old = 3.0
        >>> model.calc_qdga1_v1()
        >>> states.qdga1
        qdga1(3.800054)

        First extreme test case (zero division is circumvented):

        >>> derived.kd1(0.0)
        >>> model.calc_qdga1_v1()
        >>> states.qdga1
        qdga1(4.0)

        Second extreme test case (numerical overflow is circumvented):

        >>> derived.kd1(1e500)
        >>> model.calc_qdga1_v1()
        >>> states.qdga1
        qdga1(5.0)
    """
    der = self.parameters.derived.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    if der.kd1 <= 0.:
        new.qdga1 = new.qdgz1
    elif der.kd1 > 1e200:
        new.qdga1 = old.qdga1+new.qdgz1-old.qdgz1
    else:
        d_temp = (1.-modelutils.exp(-1./der.kd1))
        new.qdga1 = (old.qdga1 +
                     (old.qdgz1-old.qdga1)*d_temp +
                     (new.qdgz1-old.qdgz1)*(1.-der.kd1*d_temp))


def calc_qdga2_v1(self):
    """Perform the runoff concentration calculation for "fast" direct runoff.

    The working equation is the analytical solution of the linear storage
    equation under the assumption of constant change in inflow during
    the simulation time step.

    Required derived parameter:
      |KD2|

    Required state sequence:
      |QDGZ2|

    Calculated state sequence:
      |QDGA2|

    Basic equation:
       :math:`QDGA2_{neu} = QDGA2_{alt} +
       (QDGZ2_{alt}-QDGA2_{alt}) \\cdot (1-exp(-KD2^{-1})) +
       (QDGZ2_{neu}-QDGZ2_{alt}) \\cdot (1-KD2\\cdot(1-exp(-KD2^{-1})))`

    Examples:

        A normal test case:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> derived.kd2(0.1)
        >>> states.qdgz2.old = 2.0
        >>> states.qdgz2.new = 4.0
        >>> states.qdga2.old = 3.0
        >>> model.calc_qdga2_v1()
        >>> states.qdga2
        qdga2(3.800054)

        First extreme test case (zero division is circumvented):

        >>> derived.kd2(0.0)
        >>> model.calc_qdga2_v1()
        >>> states.qdga2
        qdga2(4.0)

        Second extreme test case (numerical overflow is circumvented):

        >>> derived.kd2(1e500)
        >>> model.calc_qdga2_v1()
        >>> states.qdga2
        qdga2(5.0)
    """
    der = self.parameters.derived.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    if der.kd2 <= 0.:
        new.qdga2 = new.qdgz2
    elif der.kd2 > 1e200:
        new.qdga2 = old.qdga2+new.qdgz2-old.qdgz2
    else:
        d_temp = (1.-modelutils.exp(-1./der.kd2))
        new.qdga2 = (old.qdga2 +
                     (old.qdgz2-old.qdga2)*d_temp +
                     (new.qdgz2-old.qdgz2)*(1.-der.kd2*d_temp))


def calc_q_v1(self):
    """Calculate the final runoff.

    Note that, in case there are water areas, their |NKor| values are
    added and their |EvPo| values are subtracted from the "potential"
    runoff value, if possible.  This hold true for |WASSER| only and is
    due to compatibility with the original LARSIM implementation. Using land
    type |WASSER| can result  in problematic modifications of simulated
    runoff series. It seems advisable to use land type |FLUSS| and/or
    land type |SEE| instead.

    Required control parameters:
      |NHRU|
      |FHRU|
      |Lnk|
      |NegQ|

    Required flux sequence:
      |NKor|

    Updated flux sequence:
      |EvI|

    Required state sequences:
      |QBGA|
      |QIGA1|
      |QIGA2|
      |QDGA1|
      |QDGA2|

    Calculated flux sequence:
      |lland_fluxes.Q|

    Basic equations:
       :math:`Q = QBGA + QIGA1 + QIGA2 + QDGA1 + QDGA2 +
       NKor_{WASSER} - EvI_{WASSER}`
       :math:`Q \\geq 0`

    Examples:

        When there are no water areas in the respective subbasin (we
        choose arable land |ACKER| arbitrarily), the different runoff
        components are simply summed up:

        >>> from hydpy.models.lland import *
        >>> parameterstep()
        >>> nhru(3)
        >>> lnk(ACKER, ACKER, ACKER)
        >>> fhru(0.5, 0.2, 0.3)
        >>> negq(False)
        >>> states.qbga = 0.1
        >>> states.qiga1 = 0.3
        >>> states.qiga2 = 0.5
        >>> states.qdga1 = 0.7
        >>> states.qdga2 = 0.9
        >>> fluxes.nkor = 10.0
        >>> fluxes.evi = 4.0, 5.0, 3.0
        >>> model.calc_q_v1()
        >>> fluxes.q
        q(2.5)
        >>> fluxes.evi
        evi(4.0, 5.0, 3.0)

        The defined values of interception evaporation do not show any
        impact on the result of the given example, the predefined values
        for sequence |EvI| remain unchanged.  But when the first HRU is
        assumed to be a water area (|WASSER|), its adjusted precipitaton
        |NKor| value and its interception  evaporation |EvI| value are added
        to and subtracted from |lland_fluxes.Q| respectively:

        >>> control.lnk(WASSER, VERS, NADELW)
        >>> model.calc_q_v1()
        >>> fluxes.q
        q(5.5)
        >>> fluxes.evi
        evi(4.0, 5.0, 3.0)

        Note that only 5 mm are added (instead of the |NKor| value 10 mm)
        and that only 2 mm are substracted (instead of the |EvI| value 4 mm,
        as the first HRU`s area only accounts for 50 % of the subbasin area.

        Setting also the land use class of the second HRU to land type
        |WASSER| and resetting |NKor| to zero would result in overdrying.
        To avoid this, both actual water evaporation values stored in
        sequence |EvI| are reduced by the same factor:

        >>> control.lnk(WASSER, WASSER, NADELW)
        >>> fluxes.nkor = 0.0
        >>> model.calc_q_v1()
        >>> fluxes.q
        q(0.0)
        >>> fluxes.evi
        evi(3.333333, 4.166667, 3.0)

        The handling from water areas of type |FLUSS| and |SEE| differs
        from those of type |WASSER|, as these do receive their net input
        before the runoff concentration routines are applied.  This
        should be more realistic in most cases (especially for type |SEE|
        representing lakes not direct connected to the stream network).
        But it could sometimes result in negative outflow values. This
        is avoided by simply setting |lland_fluxes.Q| to zero and adding
        the truncated negative outflow value to the |EvI| value of all
        HRUs of type |FLUSS| and |SEE|:

        >>> control.lnk(FLUSS, SEE, NADELW)
        >>> states.qbga = -1.0
        >>> states.qdga2 = -1.5
        >>> fluxes.evi = 4.0, 5.0, 3.0
        >>> model.calc_q_v1()
        >>> fluxes.q
        q(0.0)
        >>> fluxes.evi
        evi(2.571429, 3.571429, 3.0)

        This adjustment of |EvI| is only correct regarding the total
        water balance.  Neither spatial nor temporal consistency of the
        resulting |EvI| values are assured.  In the most extreme case,
        even negative |EvI| values might occur.  This seems acceptable,
        as long as the adjustment of |EvI| is rarely triggered.  When in
        doubt about this, check sequences |EvPo| and |EvI| of HRUs of
        types |FLUSS| and |SEE| for possible discrepancies.  Also note
        that there might occur unnecessary corrections of |lland_fluxes.Q|
        in case landtype |WASSER| is combined with either landtype
        |SEE| or |FLUSS|.

        Eventually you might want to avoid correcting |lland_fluxes.Q|.
        This can be achieved by setting parameter |NegQ| to `True`:

        >>> negq(True)
        >>> fluxes.evi = 4.0, 5.0, 3.0
        >>> model.calc_q_v1()
        >>> fluxes.q
        q(-1.0)
        >>> fluxes.evi
        evi(4.0, 5.0, 3.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    aid = self.sequences.aides.fastaccess
    flu.q = sta.qbga+sta.qiga1+sta.qiga2+sta.qdga1+sta.qdga2
    if not con.negq:
        if flu.q < 0.:
            d_area = 0.
            for k in range(con.nhru):
                if con.lnk[k] in (FLUSS, SEE):
                    d_area += con.fhru[k]
            if d_area > 0.:
                for k in range(con.nhru):
                    if con.lnk[k] in (FLUSS, SEE):
                        flu.evi[k] += flu.q/d_area
            flu.q = 0.
    aid.epw = 0.
    for k in range(con.nhru):
        if con.lnk[k] == WASSER:
            flu.q += con.fhru[k]*flu.nkor[k]
            aid.epw += con.fhru[k]*flu.evi[k]
    if (flu.q > aid.epw) or con.negq:
        flu.q -= aid.epw
    elif aid.epw > 0.:
        for k in range(con.nhru):
            if con.lnk[k] == WASSER:
                flu.evi[k] *= flu.q/aid.epw
        flu.q = 0.


def pass_q_v1(self):
    """Update the outlet link sequence.

    Required derived parameter:
      |QFactor|

    Required flux sequences:
      |lland_fluxes.Q|

    Calculated flux sequence:
      |lland_outlets.Q|

    Basic equation:
       :math:`Q_{outlets} = QFactor \\cdot Q_{fluxes}`
    """
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += der.qfactor*flu.q


class Model(modeltools.Model):
    """Base model for HydPy-L-Land."""

    _RUN_METHODS = (calc_nkor_v1,
                    calc_tkor_v1,
                    calc_et0_v1,
                    calc_et0_wet0_v1,
                    calc_evpo_v1,
                    calc_nbes_inzp_v1,
                    calc_evi_inzp_v1,
                    calc_sbes_v1,
                    calc_wgtf_v1,
                    calc_schm_wats_v1,
                    calc_wada_waes_v1,
                    calc_evb_v1,
                    calc_qbb_v1,
                    calc_qib1_v1,
                    calc_qib2_v1,
                    calc_qdb_v1,
                    calc_bowa_v1,
                    calc_qbgz_v1,
                    calc_qigz1_v1,
                    calc_qigz2_v1,
                    calc_qdgz_v1,
                    calc_qdgz1_qdgz2_v1,
                    calc_qbga_v1,
                    calc_qiga1_v1,
                    calc_qiga2_v1,
                    calc_qdga1_v1,
                    calc_qdga2_v1,
                    calc_q_v1)
    _OUTLET_METHODS = (pass_q_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Runoff [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of the HydPy-L-Land model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_parameters.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
# -*- coding: utf-8 -*-

# import...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools
# ...model specific
from hydpy.models.lland import lland_constants


class MultiParameter(parametertools.ZipParameter):
    """Base class for handling parameters of the HydPy-L-Land model
    (potentially) handling multiple values.

    Class |lland_parameters.MultiParameter| of HydPy-L-Land basically
    works like class |hland_parameters.MultiParameter| of HydPy-H-Land,
    except that keyword arguments specific to HydPy-L-Land are applied
    (acker, nadelw, wasser..., see module |lland_constants|) and except
    that parameter |NHRU| determines the number of entries:

    >>> from hydpy.models.lland.lland_parameters import MultiParameter
    >>> from hydpy.models.lland import *
    >>> parameterstep('1d')
    >>> mp = MultiParameter()
    >>> mp.subpars = control
    >>> mp.shape
    Traceback (most recent call last):
    ...
    RuntimeError: Shape information for parameter `multiparameter` can only \
be retrieved after it has been defined.  You can do this manually, but \
usually it is done automatically by defining the value of parameter `nhru` \
first in each parameter control file.
    """
    REQUIRED_VALUES = tuple(lland_constants.CONSTANTS.values())
    MODEL_CONSTANTS = lland_constants.CONSTANTS

    @property
    def refparameter(self):
        """Alias for the associated instance of |Lnk|.
        """
        return self.subpars.pars.control.lnk

    @property
    def shapeparameter(self):
        """Alias for the associated instance of |NHRU|.
        """
        return self.subpars.pars.control.nhru


class MultiParameterLand(MultiParameter):
    """Base class for handling parameters of HydPy-L-Land (potentially)
    handling multiple values relevant for non water HRUs.
    """
    REQUIRED_VALUES = tuple(value for (key, value)
                            in lland_constants.CONSTANTS.items()
                            if value != 'WASSER')


class MultiParameterSoil(MultiParameter):
    """Base class for handling parameters of HydPy-L-Land (potentially)
    handling multiple values relevant for non water HRUs without sealed
    surfaces.
    """
    REQUIRED_VALUES = tuple(value for (key, value)
                            in lland_constants.CONSTANTS.items()
                            if value not in ('WASSER', 'VERS'))


class LanduseMonthParameter(parametertools.KeywordParameter2D):
    """Base class for parameters which values depend both an the actual
    land use class and the actual month.
    """
    COLNAMES = ('jan', 'feb', 'mar', 'apr', 'mai', 'jun',
                'jul', 'aug', 'sep', 'oct', 'nov', 'dec')
    ROWNAMES = tuple(key.lower() for (idx, key)
                     in (sorted((idx, key) for (key, idx) in
                         lland_constants.CONSTANTS.items())))

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lland/lland_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...from site-packages
import numpy
# ...HydPy specific
from hydpy.core import sequencetools


class Inzp(sequencetools.StateSequence):
    """Interzeptionsspeicherung (interception storage) [mm].

    Note that |Inzp| of HydPy-L implements no specialized trim method
    (as opposed to |hland_states.Ic| of |hland|).  This is due the
    discontinuous evolution of |KInz| in time.  In accordance with the
    original LARSIM implementation, |Inzp| can be temporarily overfilled
    during rain periods whenever |KInz| drops rapidly between two months.
    A specialized trim method would just make the excess water vanish.
    But in HydPy-L, the excess water becomes |NBes| in the first
    simulation step of the new month.
    """
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class WATS(sequencetools.StateSequence):
    """Wasseräquivalent Trockenschnee (frozen water equivalent of the snow
    cover) [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def trim(self, lower=None, upper=None):
        """Trim values in accordance with :math:`WAeS \\leq PWMax \\cdot WATS`,
        or at least in accordance with if :math:`WATS \\geq 0`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(7)
        >>> pwmax(2.0)
        >>> states.waes = -1., 0., 1., -1., 5., 10., 20.
        >>> states.wats(-1., 0., 0., 5., 5., 5., 5.)
        >>> states.wats
        wats(0.0, 0.0, 0.5, 5.0, 5.0, 5.0, 10.0)
        """
        pwmax = self.subseqs.seqs.model.parameters.control.pwmax
        waes = self.subseqs.waes
        if lower is None:
            lower = numpy.clip(waes/pwmax, 0., numpy.inf)
            lower[numpy.isnan(lower)] = 0.0
        sequencetools.StateSequence.trim(self, lower, upper)


class WAeS(sequencetools.StateSequence):
    """Wasseräquivalent Gesamtschnee (total water equivalent of the snow
    cover) [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def trim(self, lower=None, upper=None):
        """Trim values in accordance with :math:`WAeS \\leq PWMax \\cdot WATS`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(7)
        >>> pwmax(2.)
        >>> states.wats = 0., 0., 0., 5., 5., 5., 5.
        >>> states.waes(-1., 0., 1., -1., 5., 10., 20.)
        >>> states.waes
        waes(0.0, 0.0, 0.0, 0.0, 5.0, 10.0, 10.0)
        """
        pwmax = self.subseqs.seqs.model.parameters.control.pwmax
        wats = self.subseqs.wats
        if upper is None:
            upper = pwmax*wats
        sequencetools.StateSequence.trim(self, lower, upper)


class BoWa(sequencetools.StateSequence):
    """Bodenwasserspeicherung (soil water storage) [mm]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)

    def trim(self, lower=None, upper=None):
        """Trim values in accordance with :math:`BoWa \\leq NFk`.

        >>> from hydpy.models.lland import *
        >>> parameterstep('1d')
        >>> nhru(5)
        >>> nfk(200.)
        >>> states.bowa(-100.,0., 100., 200., 300.)
        >>> states.bowa
        bowa(0.0, 0.0, 100.0, 200.0, 200.0)
        """
        if upper is None:
            upper = self.subseqs.seqs.model.parameters.control.nfk
        sequencetools.StateSequence.trim(self, lower, upper)


class QDGZ1(sequencetools.StateSequence):
    """Zufluss in den trägeren Direktabfluss-Gebietsspeicher (inflow into
    the less responsive storage compartment for direct runoff) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QDGZ2(sequencetools.StateSequence):
    """Zufluss in den dynamischeren Direktabfluss-Gebietsspeicher (inflow into
    the more responsive storage compartment for direct runoff) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (None, None)


class QIGZ1(sequencetools.StateSequence):
    """"Zufluss in den ersten Zwischenabfluss-Gebietsspeicher (inflow into the
    first storage compartment for interflow) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QIGZ2(sequencetools.StateSequence):
    """Zufluss in den zweiten Zwischenabfluss-Gebietsspeicher (inflow into the
    second storage compartment for interflow) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QBGZ(sequencetools.StateSequence):
    """Zufluss in den Basisabfluss-Gebietsspeicher (inflow into the
    storage compartment for base flow) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (None, None)


class QDGA1(sequencetools.StateSequence):
    """Abfluss aus dem trägeren Direktabfluss-Gebietsspeicher (outflow from
    the less responsive storage compartment for direct runoff) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QDGA2(sequencetools.StateSequence):
    """Abfluss aus dem dynamischeren Direktabfluss-Gebietsspeicher (outflow
    from the more responsive storage compartment for direct runoff) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (None, None)


class QIGA1(sequencetools.StateSequence):
    """Abfluss aus dem "unteren" Zwischenabfluss-Gebietsspeicher (outflow from
    the storage compartment for the first interflow component) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QIGA2(sequencetools.StateSequence):
    """Abfluss aus dem "oberen" Zwischenabfluss-Gebietsspeicher (outflow from
    the storage compartment for the second interflow component) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QBGA(sequencetools.StateSequence):
    """Abfluss aus dem Basisabfluss-Gebietsspeicher (outflow from the
    storage compartment for base flow) [mm]."""
    NDIM, NUMERIC, SPAN = 0, False, (None, None)


class StateSequences(sequencetools.StateSequences):
    """State sequences of the HydPy-L-Land model."""
    _SEQCLASSES = (Inzp,
                   WATS,
                   WAeS,
                   BoWa,
                   QDGZ1,
                   QDGZ2,
                   QIGZ1,
                   QIGZ2,
                   QBGZ,
                   QDGA1,
                   QDGA2,
                   QIGA1,
                   QIGA2,
                   QBGA)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
# -*- coding: utf-8 -*-
"""
The L-Stream model defines the methods and classes required for
performing  flood routing calculations after the Williams method
as implemented in LARSIM.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from lstream
from hydpy.models.lstream.lstream_control import ControlParameters
from hydpy.models.lstream.lstream_derived import DerivedParameters
from hydpy.models.lstream.lstream_fluxes import FluxSequences
from hydpy.models.lstream.lstream_states import StateSequences
from hydpy.models.lstream.lstream_aides import AideSequences
from hydpy.models.lstream.lstream_inlets import InletSequences
from hydpy.models.lstream.lstream_outlets import OutletSequences
from hydpy.models.lstream.lstream_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_aides.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Temp(sequencetools.AideSequence):
    """Temporäre Variable (temporary variable) [-]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class HMin(sequencetools.AideSequence):
    """Untere Wasserstandsgrenze (lower water stage boundary) [m]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class HMax(sequencetools.AideSequence):
    """Obere Wasserstandsgrenze (upper water stage boundary) [m]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QMin(sequencetools.AideSequence):
    """Untere Abflussgrenze (lower discharge boundary) [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QMax(sequencetools.AideSequence):
    """Obere Abflussgrenze (upper discharge boundary) [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QTest(sequencetools.AideSequence):
    """Vergleichsabfluss (discharge to be compared) [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class AideSequences(sequencetools.AideSequences):
    """Aide sequences of HydPy-L-Stream."""
    _SEQCLASSES = (Temp, HMin, HMax, QMin, QMax, QTest)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class Laen(parametertools.SingleParameter):
    """Flusslänge (channel length) [km]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class Gef(parametertools.SingleParameter):
    """Sohlgefälle (channel slope) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class HM(parametertools.SingleParameter):
    """Höhe Hauptgerinne (height of the main channel) [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class BM(parametertools.SingleParameter):
    """Sohlbreite Hauptgerinne (bed width of the main channel) [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class BNM(parametertools.SingleParameter):
    """Böschungsneigung Hauptgerinne (slope of both main channel embankments)
    [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class BV(parametertools.LeftRightParameter):
    """Sohlbreite Vorländer (bed widths of both forelands) [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class BBV(parametertools.LeftRightParameter):
    """Breite Vorlandböschungen (width of both foreland embankments) [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class BNV(parametertools.LeftRightParameter):
    """Böschungsneigung Vorländer (slope of both foreland embankments) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class BNVR(parametertools.LeftRightParameter):
    """Böschungsneigung Vorlandränder (slope of both outer embankments) [-]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class SKM(parametertools.SingleParameter):
    """Rauigkeitsbeiwert Hauptgerinne (roughness coefficient of the main
    channel) [m^(1/3)/s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class SKV(parametertools.LeftRightParameter):
    """Rauigkeitsbeiwert Vorländer (roughness coefficient of the both
    forelands) [m^(1/3)/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class EKM(parametertools.SingleParameter):
    """Kalibrierfaktor Hauptgerinne (calibration factor for the main
    channel) [-]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class EKV(parametertools.LeftRightParameter):
    """Kalibrierfaktor Vorländer (calibration factor for both forelands) [m].
    """
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)


class QTol(parametertools.SingleParameter):
    """Approximationstoleranz Abfluss (discharge related stopping criterion
    for root-finding algorithms) [m³/s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 1e-6


class HTol(parametertools.SingleParameter):
    """Approximationstoleranz Wasserstand (water stage related stopping
    criterion for root-finding algorithms) [m]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)
    INIT = 1e-6


class ControlParameters(parametertools.SubParameters):
    """Control parameters HydPy-L-Stream, directly defined by the user."""
    _PARCLASSES = (Laen, Gef, HM, BM, BV, BBV, BNM, BNV, BNVR,
                   SKM, SKV, EKM, EKV, QTol, HTol)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_derived.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class HV(parametertools.LeftRightParameter):
    """Höhe Vorländer (height of both forelands) [m]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        """Update value based on :math:`HV=BBV/BNV`.

        Required Parameters:
            |BBV|
            |BNV|

        Examples:
            >>> from hydpy.models.lstream import *
            >>> parameterstep('1d')
            >>> bbv(left=10., right=40.)
            >>> bnv(left=10., right=20.)
            >>> derived.hv.update()
            >>> derived.hv
            hv(1.0, 2.0)
            >>> bbv(left=10., right=0.)
            >>> bnv(left=0., right=20.)
            >>> derived.hv.update()
            >>> derived.hv
            hv(0.0)
        """
        con = self.subpars.pars.control
        for idx in range(2):
            if (con.bbv[idx] > 0.) and (con.bnv[idx] > 0.):
                self[idx] = con.bbv[idx]/con.bnv[idx]
            else:
                self[idx] = 0.


class QM(parametertools.SingleParameter):
    """Bordvoller Abfluss Hauptgerinne (maximum discharge of the main channel)
    [m³/s]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        """Update value based on the actual |calc_qg_v1| method.

        Required derived parameter:
            |H|

        Note that the value of parameter |lstream_derived.QM| is directly
        related to the value of parameter |HM| and indirectly related to
        all parameters values relevant for method |calc_qg_v1|. Hence the
        complete paramter (and sequence) requirements might differ for
        various application models.

        For examples, see the documentation on method ToDo.
        """
        mod = self.subpars.pars.model
        con = mod.parameters.control
        flu = mod.sequences.fluxes
        flu.h = con.hm
        mod.calc_qg()
        self.value = flu.qg


class QV(parametertools.LeftRightParameter):
    """Bordvoller Abfluss Vorländer (maximum discharge of both forelands)
    [m³/s]."""
    NDIM, TYPE, TIME, SPAN = 1, float, None, (0., None)

    def update(self):
        """Update value based on the actual |calc_qg_v1| method.

        Required derived parameter:
            |HV|

        Note that the values of parameter |lstream_derived.QV| are
        directly related to the values of parameter |HV| and indirectly
        related to all parameters values relevant for method |calc_qg_v1|.
        Hence the complete paramter (and sequence) requirements might
        differ for various application models.

        For examples, see the documentation on method ToDo.
        """
        mod = self.subpars.pars.model
        con = mod.parameters.control
        der = self.subpars
        flu = mod.sequences.fluxes
        for idx in range(2):
            flu.h = con.hm+der.hv[idx]
            mod.calc_qg()
            self[idx] = flu.qg


class Sek(parametertools.SingleParameter):
    """ Sekunden im Simulationszeitschritt (Number of seconds of the selected
    simulation time step) [T]."""
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)

    def update(self):
        """Update value based on |Parameter.simulationstep|.

        Example:
            >>> from hydpy.models.lstream import *
            >>> parameterstep()
            >>> simulationstep('1d')
            >>> derived.sek.update()
            >>> derived.sek
            sek(86400.0)
        """
        self(self.simulationstep.seconds)


class DerivedParameters(parametertools.SubParameters):
    """Derived parameters of HydPy-L-Stream, indirectly defined by the user."""
    _PARCLASSES = (HV, QM, QV, Sek)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class QRef(sequencetools.FluxSequence):
    """Referenzabfluss (reference flow) [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class H(sequencetools.FluxSequence):
    """Wasserstand (water stage) [m]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class AM(sequencetools.FluxSequence):
    """Durchflossene Fläche Hauptgerinne (flown through area of the
    main channel) [m²]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class AV(sequencetools.LeftRightSequence):
    """Durchflossene Fläche Vorländer (flown through area of both forelands)
    [m²]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class AVR(sequencetools.LeftRightSequence):
    """Durchflossene Fläche Vorlandränder (flown through area of both outer
    embankments) [m²]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class AG(sequencetools.FluxSequence):
    """Durchflossene Fläche gesamt  (total flown through area) [m²]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class UM(sequencetools.FluxSequence):
    """Benetzter Umfang Hauptgerinne (wetted perimeter of the
    main channel) [m]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class UV(sequencetools.LeftRightSequence):
    """Benetzter Umfang Vorländer (wetted perimeter of both forelands) [m]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class UVR(sequencetools.LeftRightSequence):
    """Benetzter Umfang Vorlandränder (wetted perimeter of both outer
    embankments) [m]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class QM(sequencetools.FluxSequence):
    """Durchfluss Hauptgerinne (discharge of the main channel) [m³]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QV(sequencetools.LeftRightSequence):
    """Durchfluss Voränder (discharge of both forelands) [m³]."""
    NDIM, NUMERIC, SPAN = 1, False, (0., None)


class QVR(sequencetools.LeftRightSequence):
    """Durchfluss Vorlandränder (discharge of both outer embankment) [m³]."""
    NDIM, NUMERIC, SPAN = 1, False, (1., None)


class QG(sequencetools.FluxSequence):
    """Durchfluss gesamt (total discharge) [m³]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class RK(sequencetools.FluxSequence):
    """Schwerpunktlaufzeit (traveling time) [T]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of HydPy-L-Stream."""
    _SEQCLASSES = (QRef, H, AM, AV, AVR, AG, UM, UV, UVR,
                   QM, QV, QVR, QG, RK)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_inlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Abfluss (runoff) [m³/s]."""
    NDIM, NUMERIC = 1, False


class InletSequences(sequencetools.LinkSequences):
    """Upstream link sequences of HydPy-L-Stream."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
270  
271  
272  
273  
274  
275  
276  
277  
278  
279  
280  
281  
282  
283  
284  
285  
286  
287  
288  
289  
290  
291  
292  
293  
294  
295  
296  
297  
298  
299  
300  
301  
302  
303  
304  
305  
306  
307  
308  
309  
310  
311  
312  
313  
314  
315  
316  
317  
318  
319  
320  
321  
322  
323  
324  
325  
326  
327  
328  
329  
330  
331  
332  
333  
334  
335  
336  
337  
338  
339  
340  
341  
342  
343  
344  
345  
346  
347  
348  
349  
350  
351  
352  
353  
354  
355  
356  
357  
358  
359  
360  
361  
362  
363  
364  
365  
366  
367  
368  
369  
370  
371  
372  
373  
374  
375  
376  
377  
378  
379  
380  
381  
382  
383  
384  
385  
386  
387  
388  
389  
390  
391  
392  
393  
394  
395  
396  
397  
398  
399  
400  
401  
402  
403  
404  
405  
406  
407  
408  
409  
410  
411  
412  
413  
414  
415  
416  
417  
418  
419  
420  
421  
422  
423  
424  
425  
426  
427  
428  
429  
430  
431  
432  
433  
434  
435  
436  
437  
438  
439  
440  
441  
442  
443  
444  
445  
446  
447  
448  
449  
450  
451  
452  
453  
454  
455  
456  
457  
458  
459  
460  
461  
462  
463  
464  
465  
466  
467  
468  
469  
470  
471  
472  
473  
474  
475  
476  
477  
478  
479  
480  
481  
482  
483  
484  
485  
486  
487  
488  
489  
490  
491  
492  
493  
494  
495  
496  
497  
498  
499  
500  
501  
502  
503  
504  
505  
506  
507  
508  
509  
510  
511  
512  
513  
514  
515  
516  
517  
518  
519  
520  
521  
522  
523  
524  
525  
526  
527  
528  
529  
530  
531  
532  
533  
534  
535  
536  
537  
538  
539  
540  
541  
542  
543  
544  
545  
546  
547  
548  
549  
550  
551  
552  
553  
554  
555  
556  
557  
558  
559  
560  
561  
562  
563  
564  
565  
566  
567  
568  
569  
570  
571  
572  
573  
574  
575  
576  
577  
578  
579  
580  
581  
582  
583  
584  
585  
586  
587  
588  
589  
590  
591  
592  
593  
594  
595  
596  
597  
598  
599  
600  
601  
602  
603  
604  
605  
606  
607  
608  
609  
610  
611  
612  
613  
614  
615  
616  
617  
618  
619  
620  
621  
622  
623  
624  
625  
626  
627  
628  
629  
630  
631  
632  
633  
634  
635  
636  
637  
638  
639  
640  
641  
642  
643  
644  
645  
646  
647  
648  
649  
650  
651  
652  
653  
654  
655  
656  
657  
658  
659  
660  
661  
662  
663  
664  
665  
666  
667  
668  
669  
670  
671  
672  
673  
674  
675  
676  
677  
678  
679  
680  
681  
682  
683  
684  
685  
686  
687  
688  
689  
690  
691  
692  
693  
694  
695  
696  
697  
698  
699  
700  
701  
702  
703  
704  
705  
706  
707  
708  
709  
710  
711  
712  
713  
714  
715  
716  
717  
718  
719  
720  
721  
722  
723  
724  
725  
726  
727  
728  
729  
730  
731  
732  
733  
734  
735  
736  
737  
738  
739  
740  
741  
742  
743  
744  
745  
746  
747  
748  
749  
750  
751  
752  
753  
754  
755  
756  
757  
758  
759  
760  
761  
762  
763  
764  
765  
766  
767  
768  
769  
770  
771  
772  
773  
774  
775  
776  
777  
778  
779  
780  
781  
782  
783  
784  
785  
786  
787  
788  
789  
790  
791  
792  
793  
794  
795  
796  
797  
798  
799  
800  
801  
802  
803  
804  
805  
806  
807  
808  
809  
810  
811  
812  
813  
814  
815  
816  
817  
818  
819  
820  
821  
822  
823  
824  
825  
826  
827  
828  
829  
830  
831  
832  
833  
834  
835  
836  
837  
838  
839  
840  
841  
842  
843  
844  
845  
846  
847  
848  
849  
850  
851  
852  
853  
854  
855  
856  
857  
858  
859  
860  
861  
862  
863  
864  
865  
866  
867  
868  
869  
870  
871  
872  
873  
874  
875  
876  
877  
878  
879  
880  
881  
882  
883  
884  
885  
886  
887  
888  
889  
890  
891  
892  
893  
894  
895  
896  
897  
898  
899  
900  
901  
902  
903  
904  
905  
906  
907  
908  
909  
910  
911  
912  
913  
914  
915  
916  
917  
918  
919  
920  
921  
922  
923  
924  
925  
926  
927  
928  
929  
930  
931  
932  
933  
934  
935  
936  
937  
938  
939  
940  
941  
942  
943  
944  
945  
946  
947  
948  
949  
950  
951  
952  
953  
954  
955  
956  
957  
958  
959  
# -*- coding: utf-8 -*-

# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools
from hydpy.cythons import modelutils


def calc_qref_v1(self):
    """Determine the reference discharge within the given space-time interval.

    Required state sequences:
      |QZ|
      |QA|

    Calculated flux sequence:
      |QRef|

    Basic equation:
      :math:`QRef = \\frac{QZ_{new}+QZ_{old}+QA_{old}}{3}`

    Example:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> states.qz.new = 3.
        >>> states.qz.old = 2.
        >>> states.qa.old = 1.
        >>> model.calc_qref_v1()
        >>> fluxes.qref
        qref(2.0)
    """
    new = self.sequences.states.fastaccess_new
    old = self.sequences.states.fastaccess_old
    flu = self.sequences.fluxes.fastaccess
    flu.qref = (new.qz+old.qz+old.qa)/3.


def calc_rk_v1(self):
    """Determine the actual traveling time of the water (not of the wave!).

    Required derived parameter:
      |Sek|

    Required flux sequences:
      |AG|
      |QRef|

    Calculated flux sequence:
      |RK|

    Basic equation:
      :math:`RK = \\frac{Laen \\cdot A}{QRef}`

    Examples:

        First, note that the traveling time is determined in the unit of the
        actual simulation step size:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> laen(25.)
        >>> derived.sek(24*60*60)
        >>> fluxes.ag = 10.
        >>> fluxes.qref = 1.
        >>> model.calc_rk_v1()
        >>> fluxes.rk
        rk(2.893519)

        Second, for negative values or zero values of |AG| or |QRef|,
        the value of |RK| is set to zero:

        >>> fluxes.ag = 0.
        >>> fluxes.qref = 1.
        >>> model.calc_rk_v1()
        >>> fluxes.rk
        rk(0.0)

        >>> fluxes.ag = 0.
        >>> fluxes.qref = 1.
        >>> model.calc_rk_v1()
        >>> fluxes.rk
        rk(0.0)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    if (flu.ag > 0.) and (flu.qref > 0.):
        flu.rk = (1000.*con.laen*flu.ag)/(der.sek*flu.qref)
    else:
        flu.rk = 0.


def calc_am_um_v1(self):
    """Calculate the flown through area and the wetted perimeter
    of the main channel.

    Note that the main channel is assumed to have identical slopes on
    both sides and that water flowing exactly above the main channel is
    contributing to |AM|.  Both theoretical surfaces seperating water
    above the main channel from water above both forelands are
    contributing to |UM|.

    Required control parameters:
      |HM|
      |BM|
      |BNM|

    Required flux sequence:
      |H|

    Calculated flux sequence:
      |AM|
      |UM|

    Examples:

        Generally, a trapezoid with reflection symmetry is assumed.  Here its
        smaller base (bottom) has a length of 2 meters, its legs show an
        inclination of 1 meter per 4 meters, and its height (depths) is 1
        meter:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> bm(2.)
        >>> bnm(4.)
        >>> hm(1.)

        The first example deals with normal flow conditions, where water
        flows within the main channel completely (|H| < |HM|):

        >>> fluxes.h = .5
        >>> model.calc_am_um_v1()
        >>> fluxes.am
        am(2.0)
        >>> fluxes.um
        um(6.123106)

        The second example deals with high flow conditions, where water
        flows over the foreland also (|H| > |HM|):

        >>> fluxes.h = 1.5
        >>> model.calc_am_um_v1()
        >>> fluxes.am
        am(11.0)
        >>> fluxes.um
        um(11.246211)

        The third example checks the special case of a main channel with zero
        height:

        >>> hm(0.)
        >>> model.calc_am_um_v1()
        >>> fluxes.am
        am(3.0)
        >>> fluxes.um
        um(5.0)

        The fourth example checks the special case of the actual water stage
        not being larger than zero (empty channel):

        >>> fluxes.h = 0.
        >>> hm(1.)
        >>> model.calc_am_um_v1()
        >>> fluxes.am
        am(0.0)
        >>> fluxes.um
        um(0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    if flu.h <= 0.:
        flu.am = 0.
        flu.um = 0.
    elif flu.h < con.hm:
        flu.am = flu.h*(con.bm+flu.h*con.bnm)
        flu.um = con.bm+2.*flu.h*(1.+con.bnm**2)**.5
    else:
        flu.am = (con.hm*(con.bm+con.hm*con.bnm) +
                  ((flu.h-con.hm)*(con.bm+2.*con.hm*con.bnm)))
        flu.um = (con.bm)+(2.*con.hm*(1.+con.bnm**2)**.5)+(2*(flu.h-con.hm))


def calc_qm_v1(self):
    """Calculate the discharge of the main channel after Manning-Strickler.

    Required control parameters:
      |EKM|
      |SKM|
      |Gef|

    Required flux sequence:
      |AM|
      |UM|

    Calculated flux sequence:
      |lstream_fluxes.QM|

    Examples:

        For appropriate strictly positive values:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> ekm(2.)
        >>> skm(50.)
        >>> gef(.01)
        >>> fluxes.am = 3.
        >>> fluxes.um = 7.
        >>> model.calc_qm_v1()
        >>> fluxes.qm
        qm(17.053102)

        For zero or negative values of the flown through surface or
        the wetted perimeter:

        >>> fluxes.am = -1.
        >>> fluxes.um = 7.
        >>> model.calc_qm_v1()
        >>> fluxes.qm
        qm(0.0)

        >>> fluxes.am = 3.
        >>> fluxes.um = 0.
        >>> model.calc_qm_v1()
        >>> fluxes.qm
        qm(0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    if (flu.am > 0.) and (flu.um > 0.):
        flu.qm = con.ekm*con.skm*flu.am**(5./3.)/flu.um**(2./3.)*con.gef**.5
    else:
        flu.qm = 0.


def calc_av_uv_v1(self):
    """Calculate the flown through area and the wetted perimeter of both
    forelands.

    Note that the each foreland lies between the main channel and one
    outer embankment and that water flowing exactly above the a foreland
    is contributing to |AV|.  The theoretical surface seperating water
    above the main channel from water above the foreland is not
    contributing to |UV|, but the surface seperating water above the
    foreland from water above its outer embankment is contributing to |UV|.

    Required control parameters:
      |HM|
      |BV|
      |BNV|

    Required derived parameter:
      |HV|

    Required flux sequence:
      |H|

    Calculated flux sequence:
      |AV|
      |UV|

    Examples:

        Generally, right trapezoids are assumed.  Here, for simplicity, both
        forelands are assumed to be symmetrical.  Their smaller bases (bottoms)
        hava a length of 2 meters, their non-vertical legs show an inclination
        of 1 meter per 4 meters, and their height (depths) is 1 meter.  Both
        forelands lie 1 meter above the main channels bottom.

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> hm(1.)
        >>> bv(2.)
        >>> bnv(4.)
        >>> derived.hv(1.)

        The first example deals with normal flow conditions, where water flows
        within the main channel completely (|H| < |HM|):

        >>> fluxes.h = .5
        >>> model.calc_av_uv_v1()
        >>> fluxes.av
        av(0.0, 0.0)
        >>> fluxes.uv
        uv(0.0, 0.0)

        The second example deals with moderate high flow conditions, where
        water flows over both forelands, but not over their embankments
        (|HM| < |H| < (|HM| + |HV|)):

        >>> fluxes.h = 1.5
        >>> model.calc_av_uv_v1()
        >>> fluxes.av
        av(1.5, 1.5)
        >>> fluxes.uv
        uv(4.061553, 4.061553)

        The third example deals with extreme high flow conditions, where
        water flows over the both foreland and their outer embankments
        ((|HM| + |HV|) < |H|):

        >>> fluxes.h = 2.5
        >>> model.calc_av_uv_v1()
        >>> fluxes.av
        av(7.0, 7.0)
        >>> fluxes.uv
        uv(6.623106, 6.623106)

        The forth example assures that zero widths or hights of the forelands
        are handled properly:

        >>> bv.left = 0.
        >>> derived.hv.right = 0.
        >>> model.calc_av_uv_v1()
        >>> fluxes.av
        av(4.0, 3.0)
        >>> fluxes.uv
        uv(4.623106, 3.5)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for i in range(2):
        if flu.h <= con.hm:
            flu.av[i] = 0.
            flu.uv[i] = 0.
        elif flu.h <= (con.hm+der.hv[i]):
            flu.av[i] = (flu.h-con.hm)*(con.bv[i]+(flu.h-con.hm)*con.bnv[i]/2.)
            flu.uv[i] = con.bv[i]+(flu.h-con.hm)*(1.+con.bnv[i]**2)**.5
        else:
            flu.av[i] = (der.hv[i]*(con.bv[i]+der.hv[i]*con.bnv[i]/2.) +
                         ((flu.h-(con.hm+der.hv[i])) *
                          (con.bv[i]+der.hv[i]*con.bnv[i])))
            flu.uv[i] = ((con.bv[i])+(der.hv[i]*(1.+con.bnv[i]**2)**.5) +
                         (flu.h-(con.hm+der.hv[i])))


def calc_qv_v1(self):
    """Calculate the discharge of both forelands after Manning-Strickler.

    Required control parameters:
      |EKV|
      |SKV|
      |Gef|

    Required flux sequence:
      |AV|
      |UV|

    Calculated flux sequence:
      |lstream_fluxes.QV|

    Examples:

        For appropriate strictly positive values:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> ekv(2.)
        >>> skv(50.)
        >>> gef(.01)
        >>> fluxes.av = 3.
        >>> fluxes.uv = 7.
        >>> model.calc_qv_v1()
        >>> fluxes.qv
        qv(17.053102, 17.053102)

        For zero or negative values of the flown through surface or
        the wetted perimeter:

        >>> fluxes.av = -1., 3.
        >>> fluxes.uv = 7., 0.
        >>> model.calc_qv_v1()
        >>> fluxes.qv
        qv(0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for i in range(2):
        if (flu.av[i] > 0.) and (flu.uv[i] > 0.):
            flu.qv[i] = (con.ekv[i]*con.skv[i] *
                         flu.av[i]**(5./3.)/flu.uv[i]**(2./3.)*con.gef**.5)
        else:
            flu.qv[i] = 0.


def calc_avr_uvr_v1(self):
    """Calculate the flown through area and the wetted perimeter of both
    outer embankments.

    Note that each outer embankment lies beyond its foreland and that all
    water flowing exactly above the a embankment is added to |AVR|.
    The theoretical surface seperating water above the foreland from water
    above its embankment is not contributing to |UVR|.

    Required control parameters:
      |HM|
      |BNVR|

    Required derived parameter:
      |HV|

    Required flux sequence:
      |H|

    Calculated flux sequence:
      |AVR|
      |UVR|

    Examples:

        Generally, right trapezoids are assumed.  Here, for simplicity, both
        forelands are assumed to be symmetrical.  Their smaller bases (bottoms)
        hava a length of 2 meters, their non-vertical legs show an inclination
        of 1 meter per 4 meters, and their height (depths) is 1 meter.  Both
        forelands lie 1 meter above the main channels bottom.

        Generally, a triangles are assumed, with the vertical side
        seperating the foreland from its outer embankment.  Here, for
        simplicity, both forelands are assumed to be symmetrical.  Their
        inclinations are 1 meter per 4 meters and their lowest point is
        1 meter above the forelands bottom and 2 meters above the main
        channels bottom:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> hm(1.)
        >>> bnvr(4.)
        >>> derived.hv(1.)

        The first example deals with moderate high flow conditions, where
        water flows over the forelands, but not over their outer embankments
        (|HM| < |H| < (|HM| + |HV|)):

        >>> fluxes.h = 1.5
        >>> model.calc_avr_uvr_v1()
        >>> fluxes.avr
        avr(0.0, 0.0)
        >>> fluxes.uvr
        uvr(0.0, 0.0)

        The second example deals with extreme high flow conditions, where
        water flows over the both foreland and their outer embankments
        ((|HM| + |HV|) < |H|):

        >>> fluxes.h = 2.5
        >>> model.calc_avr_uvr_v1()
        >>> fluxes.avr
        avr(0.5, 0.5)
        >>> fluxes.uvr
        uvr(2.061553, 2.061553)
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for i in range(2):
        if flu.h <= (con.hm+der.hv[i]):
            flu.avr[i] = 0.
            flu.uvr[i] = 0.
        else:
            flu.avr[i] = (flu.h-(con.hm+der.hv[i]))**2*con.bnvr[i]/2.
            flu.uvr[i] = (flu.h-(con.hm+der.hv[i]))*(1.+con.bnvr[i]**2)**.5


def calc_qvr_v1(self):
    """Calculate the discharge of both outer embankments after
    Manning-Strickler.

    Required control parameters:
      |EKV|
      |SKV|
      |Gef|

    Required flux sequence:
      |AVR|
      |UVR|

    Calculated flux sequence:
      |QVR|

    Examples:

        For appropriate strictly positive values:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> ekv(2.)
        >>> skv(50.)
        >>> gef(.01)
        >>> fluxes.avr = 3.
        >>> fluxes.uvr = 7.
        >>> model.calc_qvr_v1()
        >>> fluxes.qvr
        qvr(17.053102, 17.053102)

        For zero or negative values of the flown through surface or
        the wetted perimeter:

        >>> fluxes.avr = -1., 3.
        >>> fluxes.uvr = 7., 0.
        >>> model.calc_qvr_v1()
        >>> fluxes.qvr
        qvr(0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    for i in range(2):
        if (flu.avr[i] > 0.) and (flu.uvr[i] > 0.):
            flu.qvr[i] = (con.ekv[i]*con.skv[i] *
                          flu.avr[i]**(5./3.)/flu.uvr[i]**(2./3.)*con.gef**.5)
        else:
            flu.qvr[i] = 0.


def calc_ag_v1(self):
    """Sum the through flown area of the total cross section.

    Required flux sequences:
      |AM|
      |AV|
      |AVR|

    Calculated flux sequence:
      |AG|

    Example:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> fluxes.am = 1.
        >>> fluxes.av= 2., 3.
        >>> fluxes.avr = 4., 5.
        >>> model.calc_ag_v1()
        >>> fluxes.ag
        ag(15.0)
    """
    flu = self.sequences.fluxes.fastaccess
    flu.ag = flu.am+flu.av[0]+flu.av[1]+flu.avr[0]+flu.avr[1]


def calc_qg_v1(self):
    """Calculate the discharge of the total cross section.

    Method |calc_qg_v1| applies the actual versions of all methods for
    calculating the flown through areas, wetted perimeters and discharges
    of the different cross section compartments.  Hence its requirements
    might be different for various application models.
    """
    flu = self.sequences.fluxes.fastaccess
    self.calc_am_um()
    self.calc_qm()
    self.calc_av_uv()
    self.calc_qv()
    self.calc_avr_uvr()
    self.calc_qvr()
    flu.qg = flu.qm+flu.qv[0]+flu.qv[1]+flu.qvr[0]+flu.qvr[1]


def calc_hmin_qmin_hmax_qmax_v1(self):
    """Determine an starting interval for iteration methods as the one
    implemented in method |calc_h_v1|.

    The resulting interval is determined in a manner, that on the
    one hand :math:`Qmin \\leq QRef \\leq Qmax` is fulfilled and on the
    other hand the results of method |calc_qg_v1| are continuous
    for :math:`Hmin \\leq H \\leq Hmax`.

    Required control parameter:
      |HM|

    Required derived parameters:
      |HV|
      |lstream_derived.QM|
      |lstream_derived.QV|

    Required flux sequence:
      |QRef|

    Calculated aide sequences:
      |HMin|
      |HMax|
      |QMin|
      |QMax|

    Besides the mentioned required parameters and sequences, those of the
    actual method for calculating the discharge of the total cross section
    might be required.  This is the case whenever water flows on both outer
    embankments.  In such occasions no previously determined upper boundary
    values are available and method |calc_hmin_qmin_hmax_qmax_v1| needs
    to increase the value of :math:`HMax` successively until the condition
    :math:`QG \\leq QMax` is met.
    """
    con = self.parameters.control.fastaccess
    der = self.parameters.derived.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    if flu.qref <= der.qm:
        aid.hmin = 0.
        aid.qmin = 0.
        aid.hmax = con.hm
        aid.qmax = der.qm
    elif flu.qref <= min(der.qv[0], der.qv[1]):
        aid.hmin = con.hm
        aid.qmin = der.qm
        aid.hmax = con.hm+min(der.hv[0], der.hv[1])
        aid.qmax = min(der.qv[0], der.qv[1])
    elif flu.qref < max(der.qv[0], der.qv[1]):
        aid.hmin = con.hm+min(der.hv[0], der.hv[1])
        aid.qmin = min(der.qv[0], der.qv[1])
        aid.hmax = con.hm+max(der.hv[0], der.hv[1])
        aid.qmax = max(der.qv[0], der.qv[1])
    else:
        flu.h = con.hm+max(der.hv[0], der.hv[1])
        aid.hmin = flu.h
        aid.qmin = flu.qg
        while True:
            flu.h *= 2.
            self.calc_qg()
            if flu.qg < flu.qref:
                aid.hmin = flu.h
                aid.qmin = flu.qg
            else:
                aid.hmax = flu.h
                aid.qmax = flu.qg
                break


def calc_h_v1(self):
    """Approximate the water stage resulting in a certain reference discarge
    with the Pegasus iteration method.

    Required control parameters:
      |QTol|
      |HTol|

    Required flux sequence:
      |QRef|

    Calculated aide sequences:
      |HMin|
      |HMax|
      |QMin|
      |QMax|

    Calculated flux sequence:
      |H|

    Besides the parameters and sequences given above, those of the
    actual method for calculating the discharge of the total cross section
    are required.

    Examples:
        Essentially, the Pegasus method is a root finding algorithm which
        sequentially decreases its search radius (like the simple bisection
        algorithm) and shows superlinear convergence properties (like the
        Newton-Raphson algorithm).  Ideally, its convergence should be proved
        for each application model to be derived from HydPy-L-Stream.
        The following examples focus on the methods
        |calc_hmin_qmin_hmax_qmax_v1| and |calc_qg_v1| (including their
        submethods) only:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> model.calc_hmin_qmin_hmax_qmax = model.calc_hmin_qmin_hmax_qmax_v1
        >>> model.calc_qg = model.calc_qg_v1
        >>> model.calc_qm = model.calc_qm_v1
        >>> model.calc_av_uv = model.calc_av_uv_v1
        >>> model.calc_qv = model.calc_qv_v1
        >>> model.calc_avr_uvr = model.calc_avr_uvr_v1
        >>> model.calc_qvr = model.calc_qvr_v1

        Define the geometry and roughness values for the first test channel:

        >>> bm(2.)
        >>> bnm(4.)
        >>> hm(1.)
        >>> bv(.5, 10.)
        >>> bbv(1., 2.)
        >>> bnv(1., 8.)
        >>> bnvr(20.)
        >>> ekm(1.)
        >>> skm(20.)
        >>> ekv(1.)
        >>> skv(60., 80.)
        >>> gef(.01)

        Set the error tolerances of the iteration small enough, not to
        compromise the shown first six decimal places of the following results:

        >>> qtol(1e-10)
        >>> htol(1e-10)

        Derive the required secondary parameters:

        >>> derived.hv.update()
        >>> derived.qm.update()
        >>> derived.qv.update()

        Define a test function, accepting a reference discharge and printing
        both the approximated water stage and the related discharge value:

        >>> def test(qref):
        ...     fluxes.qref = qref
        ...     model.calc_hmin_qmin_hmax_qmax()
        ...     model.calc_h()
        ...     print(repr(fluxes.h))
        ...     print(repr(fluxes.qg))

        Zero discharge and the following discharge values are related to the
        only discontinuities of the given root finding problem:

        >>> derived.qm
        qm(8.399238)
        >>> derived.qv
        qv(154.463234, 23.073584)

        The related water stages are the ones (directly or indirectly)
        defined above:

        >>> test(0.)
        h(0.0)
        qg(0.0)
        >>> test(derived.qm)
        h(1.0)
        qg(8.399238)
        >>> test(derived.qv.left)
        h(2.0)
        qg(154.463234)
        >>> test(derived.qv.right)
        h(1.25)
        qg(23.073584)

        Test some intermediate water stages, inundating the only the main
        channel, the main channel along with the right foreland, and the
        main channel along with both forelands respectively:

        >>> test(6.)
        h(0.859452)
        qg(6.0)
        >>> test(10.)
        h(1.047546)
        qg(10.0)
        >>> test(100)
        h(1.77455)
        qg(100.0)

        Finally, test two extreme water stages, inundating both outer
        foreland embankments:

        >>> test(200.)
        h(2.152893)
        qg(200.0)
        >>> test(2000.)
        h(4.240063)
        qg(2000.0)

        There is a potential risk of the implemented iteration method to fail
        for special channel geometries.  To test such cases in a more
        condensed manner, the following test methods evaluates different water
        stages automatically in accordance with the example above.  An error
        message is printed only, the estimated discharge does not approximate
        the reference discharge with six decimal places:

        >>> def test():
        ...     derived.hv.update()
        ...     derived.qm.update()
        ...     derived.qv.update()
        ...     qm, qv = derived.qm, derived.qv
        ...     for qref in [0., qm, qv.left, qv.right,
        ...                  2./3.*qm+1./3.*min(qv),
        ...                  2./3.*min(qv)+1./3.*max(qv),
        ...                  3.*max(qv), 30.*max(qv)]:
        ...         fluxes.qref = qref
        ...         model.calc_hmin_qmin_hmax_qmax()
        ...         model.calc_h()
        ...         if abs(round(fluxes.qg-qref) > 0.):
        ...             print('Error!', 'qref:', qref, 'qg:', fluxes.qg)

        Check for a triangle main channel:

        >>> bm(0.)
        >>> test()
        >>> bm(2.)

        Check for a completely flat main channel:

        >>> hm(0.)
        >>> test()
        >>> hm(1.)

        Check for a nonexistend main channel:

        >>> bm(0.)
        >>> bnm(0.)
        >>> test()
        >>> bm(2.)
        >>> bnm(4.)

        Check for a nonexistend forelands:

        >>> bv(0.)
        >>> bbv(0.)
        >>> test()
        >>> bv(.5, 10.)
        >>> bbv(1., 2.)

        Check for nonexistend outer foreland embankments:

        >>> bnvr(0.)
        >>> test()

        To take the last test as an illustrative example, one can see that
        the given reference discharge is met by the estimated total discharge,
        which consists of components related to the main channel and the
        forelands only:

        >>> fluxes.qref
        qref(3932.452785)
        >>> fluxes.qg
        qg(3932.452785)
        >>> fluxes.qm
        qm(530.074621)
        >>> fluxes.qv
        qv(113.780226, 3288.597937)
        >>> fluxes.qvr
        qvr(0.0, 0.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    aid = self.sequences.aides.fastaccess
    aid.qmin -= flu.qref
    aid.qmax -= flu.qref
    if modelutils.fabs(aid.qmin) < con.qtol:
        flu.h = aid.hmin
        self.calc_qg()
    elif modelutils.fabs(aid.qmax) < con.qtol:
        flu.h = aid.hmax
        self.calc_qg()
    elif modelutils.fabs(aid.hmax-aid.hmin) < con.htol:
        flu.h = (aid.hmin+aid.hmax)/2.
        self.calc_qg()
    else:
        while True:
            flu.h = aid.hmin-aid.qmin*(aid.hmax-aid.hmin)/(aid.qmax-aid.qmin)
            self.calc_qg()
            aid.qtest = flu.qg-flu.qref
            if modelutils.fabs(aid.qtest) < con.qtol:
                return
            elif (((aid.qmax < 0.) and (aid.qtest < 0.)) or
                    ((aid.qmax > 0.) and (aid.qtest > 0.))):
                aid.qmin *= aid.qmax/(aid.qmax+aid.qtest)
            else:
                aid.hmin = aid.hmax
                aid.qmin = aid.qmax
            aid.hmax = flu.h
            aid.qmax = aid.qtest
            if modelutils.fabs(aid.hmax-aid.hmin) < con.htol:
                return


def calc_qa_v1(self):
    """Calculate outflow.

    The working equation is the analytical solution of the linear storage
    equation under the assumption of constant change in inflow during
    the simulation time step.

    Required flux sequence:
      |RK|

    Required state sequence:
      |QZ|

    Updated state sequence:
      |QA|

    Basic equation:
       :math:`QA_{neu} = QA_{alt} +
       (QZ_{alt}-QA_{alt}) \\cdot (1-exp(-RK^{-1})) +
       (QZ_{neu}-QZ_{alt}) \\cdot (1-RK\\cdot(1-exp(-RK^{-1})))`

    Examples:

        A normal test case:

        >>> from hydpy.models.lstream import *
        >>> parameterstep()
        >>> fluxes.rk(0.1)
        >>> states.qz.old = 2.
        >>> states.qz.new = 4.
        >>> states.qa.old = 3.
        >>> model.calc_qa_v1()
        >>> states.qa
        qa(3.800054)

        First extreme test case (zero division is circumvented):

        >>> fluxes.rk(0.)
        >>> model.calc_qa_v1()
        >>> states.qa
        qa(4.0)

        Second extreme test case (numerical overflow is circumvented):

        >>> fluxes.rk(1e200)
        >>> model.calc_qa_v1()
        >>> states.qa
        qa(5.0)
    """
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    aid = self.sequences.aides.fastaccess
    if flu.rk <= 0.:
        new.qa = new.qz
    elif flu.rk > 1e200:
        new.qa = old.qa+new.qz-old.qz
    else:
        aid.temp = (1.-modelutils.exp(-1./flu.rk))
        new.qa = (old.qa +
                  (old.qz-old.qa)*aid.temp +
                  (new.qz-old.qz)*(1.-flu.rk*aid.temp))


def pick_q_v1(self):
    """Update inflow."""
    sta = self.sequences.states.fastaccess
    inl = self.sequences.inlets.fastaccess
    sta.qz = 0.
    for idx in range(inl.len_q):
        sta.qz += inl.q[idx][0]


def pass_q_v1(self):
    """Update outflow."""
    sta = self.sequences.states.fastaccess
    out = self.sequences.outlets.fastaccess
    out.q[0] += sta.qa


class Model(modeltools.Model):
    """The HydPy-L-Stream model."""
    _INLET_METHODS = (pick_q_v1,)
    _RUN_METHODS = (calc_qref_v1,
                    calc_hmin_qmin_hmax_qmax_v1,
                    calc_h_v1,
                    calc_ag_v1,
                    calc_rk_v1,
                    calc_qa_v1)
    _ADD_METHODS = (calc_am_um_v1,
                    calc_qm_v1,
                    calc_av_uv_v1,
                    calc_qv_v1,
                    calc_avr_uvr_v1,
                    calc_qvr_v1,
                    calc_qg_v1)
    _OUTLET_METHODS = (pass_q_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_outlets.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.LinkSequence):
    """Abfluss (runoff) [m³/s]."""
    NDIM, NUMERIC = 0, False


class OutletSequences(sequencetools.LinkSequences):
    """Downstream link sequences of HydPy-L-Stream."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/lstream/lstream_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class QZ(sequencetools.StateSequence):
    """Zufluss in Gerinnestrecke (inflow into the channel) [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class QA(sequencetools.StateSequence):
    """Abfluss aus Gerinnestrecke (outflow out of the channel) [m³/s]."""
    NDIM, NUMERIC, SPAN = 0, False, (0., None)


class StateSequences(sequencetools.StateSequences):
    """State sequences of HydPy-L-Stream."""
    _SEQCLASSES = (QZ, QA)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/__init__.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
# -*- coding: utf-8 -*-
"""
The base model |test| is intended for implementing small application model
that allow for testing or demonstrating specific features of the HydPy
framework.
"""
# import...
# ...from standard library
from __future__ import division, print_function
# ...from HydPy
from hydpy.core.modelimports import *
# ...from test
from hydpy.models.test.test_control import ControlParameters
from hydpy.models.test.test_solver import SolverParameters
from hydpy.models.test.test_fluxes import FluxSequences
from hydpy.models.test.test_states import StateSequences
from hydpy.models.test.test_model import Model

autodoc_basemodel()
tester = Tester()
cythonizer = Cythonizer()
cythonizer.complete()

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_control.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class K(parametertools.SingleParameter):
    """Storage coefficient [1/T].

    For educational purposes, the actual value of parameter |K| does
    not depend on the difference between the actual simulation time step and
    the actual parameter time step.
    """
    NDIM, TYPE, TIME, SPAN = 0, float, None, (0., None)


class ControlParameters(parametertools.SubParameters):
    """Control parameters of the Test model, directly defined by the user."""
    _PARCLASSES = (K,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_fluxes.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class Q(sequencetools.FluxSequence):
    """Storage loss [mm/T]"""
    NDIM, NUMERIC, SPAN = 0, True, (0., None)


class FluxSequences(sequencetools.FluxSequences):
    """Flux sequences of the Test model."""
    _SEQCLASSES = (Q,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_model.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
# -*- coding: utf-8 -*-

# imports...
# ...standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import modeltools


def calc_q_v1(self):
    """Calculate the actual storage loss.

    This simple equation is continuous but potentially stiff.

    Required control parameter:
      |K|

    Required state sequence:
     |S|

    Calculated flux sequence:
      |Q|

    Basic equation:
      :math:`Q = K \\cdot S`

    Example:

       >>> from hydpy.models.test import *
       >>> parameterstep()
       >>> k(0.5)
       >>> states.s = 2.0
       >>> model.calc_q_v1()
       >>> fluxes.q
       q(1.0)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    flu.q = con.k*sta.s


def calc_q_v2(self):
    """Calculate the actual storage loss.

    This simple equation is discontinuous.

    Required control parameter:
      |K|

    Required state sequence:
      |S|

    Calculated flux sequence:
      |Q|

    Basic equation:
      :math:`Q = \\Bigl \\lbrace
      {
      {K \\ | \\ S > 0}
      \\atop
      {0 \\ | \\ S \\leq 0}
      }`

    Example:

       >>> from hydpy.models.test import *
       >>> parameterstep()
       >>> k(0.5)
       >>> states.s = 2.0
       >>> model.calc_q_v2()
       >>> fluxes.q
       q(0.5)
    """
    con = self.parameters.control.fastaccess
    flu = self.sequences.fluxes.fastaccess
    sta = self.sequences.states.fastaccess
    if sta.s > 0.:
        flu.q = con.k
    else:
        flu.q = 0.


def calc_s_v1(self):
    """Calculate the actual storage content.

    Required flux sequence:
      |Q|

    Calculated state sequence:
     |S|

    Basic equation:
      :math:`\\frac{dS}{dt} = Q`

    Example:

       >>> from hydpy.models.test import *
       >>> parameterstep()
       >>> states.s.old = 1.0
       >>> fluxes.q = 0.8
       >>> model.calc_s_v1()
       >>> states.s
       s(0.2)
    """
    flu = self.sequences.fluxes.fastaccess
    old = self.sequences.states.fastaccess_old
    new = self.sequences.states.fastaccess_new
    new.s = old.s-flu.q


class Model(modeltools.ModelELS):
    """Test model."""
    _PART_ODE_METHODS = (calc_q_v1,
                         calc_q_v2)
    _FULL_ODE_METHODS = (calc_s_v1,)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_solver.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import parametertools


class AbsErrorMax(parametertools.SolverParameter):
    """Absolute numerical error tolerance [mm/T]."""
    NDIM = 0
    TYPE = float
    TIME = None
    SPAN = (0., None)
    INIT = 0.01


class RelDTMin(parametertools.SolverParameter):
    """Smallest relative integration time step size allowed [-]."""
    NDIM = 0
    TYPE = float
    TIME = None
    SPAN = (0.0, 1.0)
    INIT = 0.001


class SolverParameters(parametertools.SubParameters):
    """Solver parameters of the Test model."""
    _PARCLASSES = (AbsErrorMax, RelDTMin)

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/hydpy/models/test/test_states.py

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
# -*- coding: utf-8 -*-

# import...
# ...from standard library
from __future__ import division, print_function
# ...HydPy specific
from hydpy.core import sequencetools


class S(sequencetools.StateSequence):
    """Storage content [mm]."""
    NDIM, NUMERIC, SPAN = 0, True, (0., None)


class StateSequences(sequencetools.StateSequences):
    """State sequences of the Test model."""
    _SEQCLASSES = (S,)